aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/tooltip.spec.js18
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">'