diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-12-16 14:23:17 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2022-01-30 15:15:17 +0300 |
commit | fa939951232b7066722e928b370fd5e56b373fba (patch) | |
tree | 5a38426f71a015c7f46defc0333aba2165b5aa4d /js/tests/unit | |
parent | 640542e6060c365c2e9cad7543822cf3d83045ae (diff) |
Event handler: replace deprecated `initEvent`
Diffstat (limited to 'js/tests/unit')
-rw-r--r-- | js/tests/unit/offcanvas.spec.js | 3 | ||||
-rw-r--r-- | js/tests/unit/util/backdrop.spec.js | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/js/tests/unit/offcanvas.spec.js b/js/tests/unit/offcanvas.spec.js index f87527fb2f..36ef45dceb 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 4303693805..f9903c8327 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() }) |