0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-19 16:54:24 +01:00

Fix popover remaining open when toggled after being shown (#40803)
Some checks failed
BrowserStack / browserstack (push) Has been skipped
Bundlewatch / bundlewatch (push) Failing after 0s
CodeQL / Analyze (push) Failing after 0s
cspell / cspell (push) Failing after 0s
CSS / css (push) Failing after 0s
Docs / docs (push) Failing after 0s
JS Tests / JS Tests (push) Failing after 0s
Lint / lint (push) Failing after 0s
CSS (node-sass) / css (push) Failing after 0s
Release notes / update_release_draft (push) Has been skipped

Co-authored-by: Dmitry Sergienko <dmitry.sergienko@codefirst.net>
Co-authored-by: Julien Déramond <juderamond@gmail.com>
This commit is contained in:
Dmitry 2024-09-12 09:45:08 +02:00 committed by GitHub
parent dcec1df61f
commit fecd219983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -160,7 +160,6 @@ class Tooltip extends BaseComponent {
return
}
this._activeTrigger.click = !this._activeTrigger.click
if (this._isShown()) {
this._leave()
return

View File

@ -56,6 +56,26 @@ describe('Popover', () => {
})
describe('show', () => {
it('should toggle a popover after show', () => {
return new Promise(resolve => {
fixtureEl.innerHTML = '<a href="#" title="Popover" data-bs-content="https://twitter.com/getbootstrap">BS twitter</a>'
const popoverEl = fixtureEl.querySelector('a')
const popover = new Popover(popoverEl)
popoverEl.addEventListener('shown.bs.popover', () => {
expect(document.querySelector('.popover')).not.toBeNull()
popover.toggle()
})
popoverEl.addEventListener('hidden.bs.popover', () => {
expect(document.querySelector('.popover')).toBeNull()
resolve()
})
popover.show()
})
})
it('should show a popover', () => {
return new Promise(resolve => {
fixtureEl.innerHTML = '<a href="#" title="Popover" data-bs-content="https://twitter.com/getbootstrap">BS twitter</a>'