Unverified Commit 43b4252a authored by Hiws's avatar Hiws Committed by GitHub
Browse files

fix tooltip hide method when already hidden (#31115)


Co-authored-by: default avatarXhmikosR <xhmikosr@gmail.com>
parent a690a67c
1 merge request!31948Examples/Floating-labels: fix bad behavior with autofill
Showing with 18 additions and 0 deletions
+18 -0
......@@ -331,6 +331,10 @@ class Tooltip {
}
hide() {
if (!this._popper) {
return
}
const tip = this.getTipElement()
const complete = () => {
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
......
......@@ -717,6 +717,20 @@ describe('Tooltip', () => {
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', () => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment