Skip to content

Commit

Permalink
Fix Popover test that randomly fails on BrowserStack (twbs#35757)
Browse files Browse the repository at this point in the history
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
  • Loading branch information
GeoSot and XhmikosR authored Feb 1, 2022
1 parent c44d99f commit 3f7b31e
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions js/tests/unit/popover.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,16 @@ describe('Popover', () => {
})

it('should NOT show a popover without `title` and `content`', () => {
return new Promise(resolve => {
fixtureEl.innerHTML = '<a href="#" data-bs-content="" title="">Nice link</a>'
fixtureEl.innerHTML = '<a href="#" data-bs-content="" title="">Nice link</a>'

const popoverEl = fixtureEl.querySelector('a')
const popover = new Popover(popoverEl, { animation: false })
spyOn(EventHandler, 'trigger').and.callThrough()
const popoverEl = fixtureEl.querySelector('a')
const popover = new Popover(popoverEl, { animation: false })
spyOn(EventHandler, 'trigger').and.callThrough()

setTimeout(() => {
expect(EventHandler.trigger).not.toHaveBeenCalled()
expect(document.querySelector('.popover')).toBeNull()
resolve()
})
popover.show()

popover.show()
})
expect(EventHandler.trigger).not.toHaveBeenCalledWith(popoverEl, Popover.Event.SHOW)
expect(document.querySelector('.popover')).toBeNull()
})

it('"setContent" should keep the initial template', () => {
Expand Down

0 comments on commit 3f7b31e

Please sign in to comment.