diff options
| author | Rohit Sharma <[email protected]> | 2021-01-14 01:29:47 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-01-13 21:59:47 +0200 |
| commit | e34481b6eb5c7b9db35911f428cb96af6947741e (patch) | |
| tree | e3675a4b136a1202e3211e4f04e47991e4af58a2 /js/tests/unit | |
| parent | d21fb9b6276cf023f99286c2e39498990ff69895 (diff) | |
| download | bootstrap-e34481b6eb5c7b9db35911f428cb96af6947741e.tar.xz bootstrap-e34481b6eb5c7b9db35911f428cb96af6947741e.zip | |
Fix toggling modal when clicking on `data-bs-toggle="modal"` (#32691)
Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/tests/unit')
| -rw-r--r-- | js/tests/unit/modal.spec.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index f645e9892..a867bec9b 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -870,7 +870,7 @@ describe('Modal', () => { }) describe('data-api', () => { - it('should open modal', done => { + it('should toggle modal', done => { fixtureEl.innerHTML = [ '<button type="button" data-bs-toggle="modal" data-bs-target="#exampleModal"></button>', '<div id="exampleModal" class="modal"><div class="modal-dialog"></div></div>' @@ -885,6 +885,15 @@ describe('Modal', () => { expect(modalEl.getAttribute('aria-hidden')).toEqual(null) expect(modalEl.style.display).toEqual('block') expect(document.querySelector('.modal-backdrop')).toBeDefined() + setTimeout(() => trigger.click(), 10) + }) + + modalEl.addEventListener('hidden.bs.modal', () => { + expect(modalEl.getAttribute('aria-modal')).toEqual(null) + expect(modalEl.getAttribute('role')).toEqual(null) + expect(modalEl.getAttribute('aria-hidden')).toEqual('true') + expect(modalEl.style.display).toEqual('none') + expect(document.querySelector('.modal-backdrop')).toEqual(null) done() }) |
