aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-12-16 13:23:17 +0200
committerXhmikosR <[email protected]>2022-01-30 14:15:17 +0200
commitfa939951232b7066722e928b370fd5e56b373fba (patch)
tree5a38426f71a015c7f46defc0333aba2165b5aa4d /js/tests/unit
parent640542e6060c365c2e9cad7543822cf3d83045ae (diff)
downloadbootstrap-fa939951232b7066722e928b370fd5e56b373fba.tar.xz
bootstrap-fa939951232b7066722e928b370fd5e56b373fba.zip
Event handler: replace deprecated `initEvent`
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/offcanvas.spec.js3
-rw-r--r--js/tests/unit/util/backdrop.spec.js3
2 files changed, 2 insertions, 4 deletions
diff --git a/js/tests/unit/offcanvas.spec.js b/js/tests/unit/offcanvas.spec.js
index f87527fb2..36ef45dce 100644
--- a/js/tests/unit/offcanvas.spec.js
+++ b/js/tests/unit/offcanvas.spec.js
@@ -191,8 +191,7 @@ describe('Offcanvas', () => {
const offCanvasEl = fixtureEl.querySelector('div')
const offCanvas = new Offcanvas(offCanvasEl, { backdrop: true })
- const clickEvent = document.createEvent('MouseEvents')
- clickEvent.initEvent('mousedown', true, true)
+ const clickEvent = new Event('mousedown', { bubbles: true, cancelable: true })
spyOn(offCanvas._backdrop._config, 'clickCallback').and.callThrough()
offCanvasEl.addEventListener('shown.bs.offcanvas', () => {
diff --git a/js/tests/unit/util/backdrop.spec.js b/js/tests/unit/util/backdrop.spec.js
index 430369380..f9903c832 100644
--- a/js/tests/unit/util/backdrop.spec.js
+++ b/js/tests/unit/util/backdrop.spec.js
@@ -169,8 +169,7 @@ describe('Backdrop', () => {
}
instance.show(() => {
- const clickEvent = document.createEvent('MouseEvents')
- clickEvent.initEvent('mousedown', true, true)
+ const clickEvent = new Event('mousedown', { bubbles: true, cancelable: true })
document.querySelector(CLASS_BACKDROP).dispatchEvent(clickEvent)
endTest()
})