mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 00:24:03 +02:00
Standardization of spyOn
usage (#36742)
This commit is contained in:
@@ -713,16 +713,16 @@ describe('Modal', () => {
|
|||||||
const dialogEl = modalEl.querySelector('.modal-dialog')
|
const dialogEl = modalEl.querySelector('.modal-dialog')
|
||||||
const modal = new Modal(modalEl)
|
const modal = new Modal(modalEl)
|
||||||
|
|
||||||
spyOn(modal, 'hide')
|
const spy = spyOn(modal, 'hide')
|
||||||
|
|
||||||
modalEl.addEventListener('shown.bs.modal', () => {
|
modalEl.addEventListener('shown.bs.modal', () => {
|
||||||
const mouseDown = createEvent('mousedown')
|
const mouseDown = createEvent('mousedown')
|
||||||
|
|
||||||
dialogEl.dispatchEvent(mouseDown)
|
dialogEl.dispatchEvent(mouseDown)
|
||||||
expect(modal.hide).not.toHaveBeenCalled()
|
expect(spy).not.toHaveBeenCalled()
|
||||||
|
|
||||||
modalEl.dispatchEvent(mouseDown)
|
modalEl.dispatchEvent(mouseDown)
|
||||||
expect(modal.hide).toHaveBeenCalled()
|
expect(spy).toHaveBeenCalled()
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user