mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 00:54:04 +02:00
Fix event handler removal in dropdown/carousel dispose (#33000)
* Fix event handler removal in carousel dispose * Fix event handler removal in dropdown dispose * Test event handlers in scrollspy dispose * Test event handlers in toast dispose * Test event handlers in tooltip dispose Co-authored-by: XhmikosR <xhmikosr@gmail.com> Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
This commit is contained in:
@@ -274,13 +274,18 @@ describe('Toast', () => {
|
||||
fixtureEl.innerHTML = '<div></div>'
|
||||
|
||||
const toastEl = fixtureEl.querySelector('div')
|
||||
spyOn(toastEl, 'addEventListener').and.callThrough()
|
||||
spyOn(toastEl, 'removeEventListener').and.callThrough()
|
||||
|
||||
const toast = new Toast(toastEl)
|
||||
|
||||
expect(Toast.getInstance(toastEl)).toBeDefined()
|
||||
expect(toastEl.addEventListener).toHaveBeenCalledWith('click', jasmine.any(Function), jasmine.any(Boolean))
|
||||
|
||||
toast.dispose()
|
||||
|
||||
expect(Toast.getInstance(toastEl)).toBeNull()
|
||||
expect(toastEl.removeEventListener).toHaveBeenCalledWith('click', jasmine.any(Function), jasmine.any(Boolean))
|
||||
})
|
||||
|
||||
it('should allow to destroy toast and hide it before that', done => {
|
||||
|
Reference in New Issue
Block a user