aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorRyan Berliner <[email protected]>2021-03-06 03:35:28 +0200
committerXhmikosR <[email protected]>2021-03-16 07:48:50 +0200
commitd491c29aa005177ef148c40d4b7b0a3decc7edef (patch)
tree9c27075749bfc602a36ed239a3e8e75fb3ea5730 /js/tests
parent6ecd1c626e4129daf45a47b44c2e2eae60a09fa3 (diff)
downloadbootstrap-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.js29
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">'