diff options
| author | Ryan Berliner <[email protected]> | 2021-03-06 03:35:28 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2021-03-16 07:48:50 +0200 |
| commit | d491c29aa005177ef148c40d4b7b0a3decc7edef (patch) | |
| tree | 9c27075749bfc602a36ed239a3e8e75fb3ea5730 /js/tests | |
| parent | 6ecd1c626e4129daf45a47b44c2e2eae60a09fa3 (diff) | |
| download | bootstrap-d491c29aa005177ef148c40d4b7b0a3decc7edef.tar.xz bootstrap-d491c29aa005177ef148c40d4b7b0a3decc7edef.zip | |
prevent tooltip from being deleted on quick re-activations
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/tooltip.spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 7bf6aa3ab..41f73d6d8 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -708,6 +708,35 @@ describe('Tooltip', () => { tooltipEl.dispatchEvent(createEvent('mouseover')) }) + it('should not hide tooltip if leave event occurs and enter event occurs during hide transition', done => { + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' + + const tooltipEl = fixtureEl.querySelector('a') + const tooltip = new Tooltip(tooltipEl) + + spyOn(window, 'getComputedStyle').and.returnValue({ + transitionDuration: '0.15s', + transitionDelay: '0s' + }) + + setTimeout(() => { + expect(tooltip._popper).not.toBeNull() + tooltipEl.dispatchEvent(createEvent('mouseout')) + + setTimeout(() => { + expect(tooltip.getTipElement().classList.contains('show')).toEqual(false) + tooltipEl.dispatchEvent(createEvent('mouseover')) + }, 100) + + setTimeout(() => { + expect(tooltip._popper).not.toBeNull() + done() + }, 200) + }, 0) + + tooltipEl.dispatchEvent(createEvent('mouseover')) + }) + it('should show a tooltip with custom class provided in data attributes', done => { fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip" data-bs-custom-class="custom-class">' |
