aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-12-15 19:54:02 +0200
committerGeoSot <[email protected]>2022-01-30 15:39:34 +0200
commit28c9002573e6cb6982697e50e1d1ebfe2ae0fc4c (patch)
tree0642e29212b102453803151c5fe95949fda807fd /js/tests
parentaa650f0f1e30279f0868433a4afab9c3efa93b2c (diff)
downloadbootstrap-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.js11
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', () => {