mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-07 04:54:24 +01:00
fix tooltip hide method when already hidden (#31115)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
parent
a690a67c7c
commit
43b4252a34
@ -331,6 +331,10 @@ class Tooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
|
if (!this._popper) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const tip = this.getTipElement()
|
const tip = this.getTipElement()
|
||||||
const complete = () => {
|
const complete = () => {
|
||||||
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
||||||
|
@ -717,6 +717,20 @@ describe('Tooltip', () => {
|
|||||||
|
|
||||||
tooltip.show()
|
tooltip.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should not throw error running hide if popper hasn\'t been shown', () => {
|
||||||
|
fixtureEl.innerHTML = '<div></div>'
|
||||||
|
|
||||||
|
const div = fixtureEl.querySelector('div')
|
||||||
|
const tooltip = new Tooltip(div)
|
||||||
|
|
||||||
|
try {
|
||||||
|
tooltip.hide()
|
||||||
|
expect().nothing()
|
||||||
|
} catch {
|
||||||
|
throw new Error('should not throw error')
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('update', () => {
|
describe('update', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user