Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-10-13 17:45:39 +0300
committerGitHub <noreply@github.com>2021-10-13 17:45:39 +0300
commitb991a6b8510216ba25cff02e0cc6c338f9f76113 (patch)
tree79df6167c374fd1f20c1f37c2e69d415e50becd6
parent9640e2d5dd4ace95d4fd9f03af160b4329e97282 (diff)
tests: try to fix a few random failures (#35184)
* Change `Swipe` dispose spy on EventHandler * Modal hide spy on backdrop hide
-rw-r--r--js/tests/unit/carousel.spec.js1
-rw-r--r--js/tests/unit/modal.spec.js3
-rw-r--r--js/tests/unit/util/swipe.spec.js7
3 files changed, 6 insertions, 5 deletions
diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js
index b048f3a882..a138f3ad55 100644
--- a/js/tests/unit/carousel.spec.js
+++ b/js/tests/unit/carousel.spec.js
@@ -1268,6 +1268,7 @@ describe('Carousel', () => {
carousel.dispose()
+ expect(carousel._swipeHelper).toBeNull()
expect(removeEventSpy).toHaveBeenCalledWith(carouselEl, Carousel.EVENT_KEY)
expect(swipeHelperSpy).toHaveBeenCalled()
diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js
index a5308eb2b2..6e7b8fc88f 100644
--- a/js/tests/unit/modal.spec.js
+++ b/js/tests/unit/modal.spec.js
@@ -608,6 +608,7 @@ describe('Modal', () => {
const modalEl = fixtureEl.querySelector('.modal')
const modal = new Modal(modalEl)
+ const backdropSpy = spyOn(modal._backdrop, 'hide').and.callThrough()
modalEl.addEventListener('shown.bs.modal', () => {
modal.hide()
@@ -622,7 +623,7 @@ describe('Modal', () => {
expect(modalEl.getAttribute('role')).toBeNull()
expect(modalEl.getAttribute('aria-hidden')).toEqual('true')
expect(modalEl.style.display).toEqual('none')
- expect(document.querySelector('.modal-backdrop')).toBeNull()
+ expect(backdropSpy).toHaveBeenCalled()
done()
})
diff --git a/js/tests/unit/util/swipe.spec.js b/js/tests/unit/util/swipe.spec.js
index d6aeb17f6a..474e34f653 100644
--- a/js/tests/unit/util/swipe.spec.js
+++ b/js/tests/unit/util/swipe.spec.js
@@ -232,7 +232,7 @@ describe('Swipe', () => {
it('should destroy', () => {
const addEventSpy = spyOn(fixtureEl, 'addEventListener').and.callThrough()
- const removeEventSpy = spyOn(fixtureEl, 'removeEventListener').and.callThrough()
+ const removeEventSpy = spyOn(EventHandler, 'off').and.callThrough()
defineDocumentElementOntouchstart()
const swipe = new Swipe(fixtureEl)
@@ -253,9 +253,8 @@ describe('Swipe', () => {
swipe.dispose()
- expect(removeEventSpy.calls.allArgs()).toEqual(expectedArgs)
-
- delete document.documentElement.ontouchstart
+ expect(removeEventSpy).toHaveBeenCalledWith(fixtureEl, '.bs.swipe')
+ deleteDocumentElementOntouchstart()
})
})