diff options
| author | Ryan Berliner <[email protected]> | 2022-01-13 03:55:05 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-13 10:55:05 +0200 |
| commit | 14c7dc1e886015f2ed845f0f8e88d3597694250f (patch) | |
| tree | 86b1432f333f304c3ead0706fdfd6a01c8f9ecd2 /js/tests | |
| parent | d581737f784d144a961d61248d42f59440159571 (diff) | |
| download | bootstrap-14c7dc1e886015f2ed845f0f8e88d3597694250f.tar.xz bootstrap-14c7dc1e886015f2ed845f0f8e88d3597694250f.zip | |
Fix: `isVisible` function behavior in case of a `<details>` element, on chrome 97 (#35682)
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/util/index.spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/js/tests/unit/util/index.spec.js b/js/tests/unit/util/index.spec.js index 52e64faa9..9d8c5ed98 100644 --- a/js/tests/unit/util/index.spec.js +++ b/js/tests/unit/util/index.spec.js @@ -320,6 +320,42 @@ describe('Util', () => { expect(Util.isVisible(div)).toBeFalse() }) + + it('should return true if its a closed details element', () => { + fixtureEl.innerHTML = '<details id="element"></details>' + + const div = fixtureEl.querySelector('#element') + + expect(Util.isVisible(div)).toBeTrue() + }) + + it('should return true if the element is visible inside an open details element', () => { + fixtureEl.innerHTML = [ + '<details open>', + ' <div id="element"></div>', + '</details>' + ].join('') + + const div = fixtureEl.querySelector('#element') + + expect(Util.isVisible(div)).toBeTrue() + }) + + it('should return true if the element is a visible summary in a closed details element', () => { + fixtureEl.innerHTML = [ + '<details>', + ' <summary id="element-1">', + ' <span id="element-2"></span>', + ' </summary>', + '</details>' + ].join('') + + const element1 = fixtureEl.querySelector('#element-1') + const element2 = fixtureEl.querySelector('#element-2') + + expect(Util.isVisible(element1)).toBeTrue() + expect(Util.isVisible(element2)).toBeTrue() + }) }) describe('isDisabled', () => { |
