diff options
| author | Rohit Sharma <[email protected]> | 2020-12-11 00:36:41 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-10 21:06:41 +0200 |
| commit | 4535b09c46b0de464dc7bca435e18bd463791112 (patch) | |
| tree | 221d60249b12a3c964a42b87f7a93b8c7c2480a6 /js/tests | |
| parent | 1edec546cb28baf68691f0eb9e43997901359ba5 (diff) | |
| download | bootstrap-4535b09c46b0de464dc7bca435e18bd463791112.tar.xz bootstrap-4535b09c46b0de464dc7bca435e18bd463791112.zip | |
Tooltip - check if tip and its parent node exist in dispose method (#32420)
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/tooltip.spec.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 9fc306dfe..2b20d7e11 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -286,6 +286,24 @@ describe('Tooltip', () => { expect(Tooltip.getInstance(tooltipEl)).toEqual(null) }) + it('should destroy a tooltip after it is shown and hidden', () => { + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' + + const tooltipEl = fixtureEl.querySelector('a') + const tooltip = new Tooltip(tooltipEl) + + tooltipEl.addEventListener('shown.bs.tooltip', () => { + tooltip.hide() + }) + tooltipEl.addEventListener('hidden.bs.tooltip', () => { + tooltip.dispose() + expect(tooltip.tip).toEqual(null) + expect(Tooltip.getInstance(tooltipEl)).toEqual(null) + }) + + tooltip.show() + }) + it('should destroy a tooltip and remove it from the dom', done => { fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' |
