diff options
| author | GeoSot <[email protected]> | 2021-12-15 19:54:02 +0200 |
|---|---|---|
| committer | GeoSot <[email protected]> | 2022-01-30 15:39:34 +0200 |
| commit | 28c9002573e6cb6982697e50e1d1ebfe2ae0fc4c (patch) | |
| tree | 0642e29212b102453803151c5fe95949fda807fd /js/tests | |
| parent | aa650f0f1e30279f0868433a4afab9c3efa93b2c (diff) | |
| download | bootstrap-28c9002573e6cb6982697e50e1d1ebfe2ae0fc4c.tar.xz bootstrap-28c9002573e6cb6982697e50e1d1ebfe2ae0fc4c.zip | |
Modal: handle click event from backdrop callback
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/modal.spec.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index bf796411b..5d3f5cd9d 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -642,8 +642,11 @@ describe('Modal', () => { modalEl.addEventListener('shown.bs.modal', () => { const spy = spyOn(modal, '_queueCallback').and.callThrough() - modalEl.click() - modalEl.click() + const mouseOverEvent = createEvent('mousedown') + const backdrop = document.querySelector('.modal-backdrop') + + backdrop.dispatchEvent(mouseOverEvent) + backdrop.dispatchEvent(mouseOverEvent) setTimeout(() => { expect(spy).toHaveBeenCalledTimes(1) @@ -710,9 +713,9 @@ describe('Modal', () => { const modalEl = fixtureEl.querySelector('.modal') const modal = new Modal(modalEl) - modalEl.addEventListener('shown.bs.modal', () => { - modalEl.click() + const mouseOverEvent = createEvent('mousedown') + document.querySelector('.modal-backdrop').dispatchEvent(mouseOverEvent) }) modalEl.addEventListener('hidden.bs.modal', () => { |
