]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix Popover test that randomly fails on BrowserStack (#35757)
authorGeoSot <geo.sotis@gmail.com>
Tue, 1 Feb 2022 08:33:18 +0000 (10:33 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Feb 2022 08:33:18 +0000 (10:33 +0200)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
js/tests/unit/popover.spec.js

index 7bbd52b1dba856e5151e71472150f5baa2f9934b..bf3a71848cb32c38b5dfc3dc6e121ffd03c958d1 100644 (file)
@@ -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', () => {