mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 17:14: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:
@@ -327,13 +327,26 @@ describe('Tooltip', () => {
|
||||
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
|
||||
|
||||
const tooltipEl = fixtureEl.querySelector('a')
|
||||
const addEventSpy = spyOn(tooltipEl, 'addEventListener').and.callThrough()
|
||||
const removeEventSpy = spyOn(tooltipEl, 'removeEventListener').and.callThrough()
|
||||
|
||||
const tooltip = new Tooltip(tooltipEl)
|
||||
|
||||
expect(Tooltip.getInstance(tooltipEl)).toEqual(tooltip)
|
||||
|
||||
const expectedArgs = [
|
||||
['mouseover', jasmine.any(Function), jasmine.any(Boolean)],
|
||||
['mouseout', jasmine.any(Function), jasmine.any(Boolean)],
|
||||
['focusin', jasmine.any(Function), jasmine.any(Boolean)],
|
||||
['focusout', jasmine.any(Function), jasmine.any(Boolean)]
|
||||
]
|
||||
|
||||
expect(addEventSpy.calls.allArgs()).toEqual(expectedArgs)
|
||||
|
||||
tooltip.dispose()
|
||||
|
||||
expect(Tooltip.getInstance(tooltipEl)).toEqual(null)
|
||||
expect(removeEventSpy.calls.allArgs()).toEqual(expectedArgs)
|
||||
})
|
||||
|
||||
it('should destroy a tooltip after it is shown and hidden', done => {
|
||||
|
Reference in New Issue
Block a user