mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-18 10:52:19 +01:00
prevent tooltip from being deleted on quick re-activations
This commit is contained in:
parent
6ecd1c626e
commit
d491c29aa0
@ -329,6 +329,10 @@ class Tooltip extends BaseComponent {
|
||||
|
||||
const tip = this.getTipElement()
|
||||
const complete = () => {
|
||||
if (this._isWithActiveTrigger()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
||||
tip.parentNode.removeChild(tip)
|
||||
}
|
||||
|
@ -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">'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user