aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/carousel.spec.js
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2021-09-09 15:29:53 +0300
committerXhmikosR <[email protected]>2021-09-09 15:33:52 +0300
commit26246f92ab1ad9d468a5679e7c1c8f85c4d152f4 (patch)
treec62a2799cd190f1040f89504465dfaf1e1e3b818 /js/tests/unit/carousel.spec.js
parentd6bf9befa92af658d4e9c5e98a727a87881ab22b (diff)
downloadbootstrap-main-xmr-mv-isTouchEnabledDevice.tar.xz
bootstrap-main-xmr-mv-isTouchEnabledDevice.zip
tests: use the util noop functionmain-xmr-mv-isTouchEnabledDevice
Diffstat (limited to 'js/tests/unit/carousel.spec.js')
-rw-r--r--js/tests/unit/carousel.spec.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js
index a933f1eda..02614323e 100644
--- a/js/tests/unit/carousel.spec.js
+++ b/js/tests/unit/carousel.spec.js
@@ -3,7 +3,7 @@ import EventHandler from '../../src/dom/event-handler'
/** Test helpers */
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
-import * as util from '../../src/util'
+import { isRTL, noop } from '../../src/util'
describe('Carousel', () => {
const { Simulator, PointerEvent } = window
@@ -331,7 +331,7 @@ describe('Carousel', () => {
// Headless browser does not support touch events, so need to fake it
// to test that touch events are add properly.
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
const carousel = new Carousel(carouselEl)
expect(carousel._addTouchEventListeners).toHaveBeenCalled()
@@ -344,7 +344,7 @@ describe('Carousel', () => {
return
}
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
document.head.append(stylesCarousel)
Simulator.setType('pointer')
@@ -389,7 +389,7 @@ describe('Carousel', () => {
return
}
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
document.head.append(stylesCarousel)
Simulator.setType('pointer')
@@ -431,7 +431,7 @@ describe('Carousel', () => {
it('should allow swiperight and call _slide (prev) with touch events', done => {
Simulator.setType('touch')
clearPointerEvents()
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
fixtureEl.innerHTML = [
'<div class="carousel" data-bs-interval="false">',
@@ -470,7 +470,7 @@ describe('Carousel', () => {
it('should allow swipeleft and call _slide (next) with touch events', done => {
Simulator.setType('touch')
clearPointerEvents()
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
fixtureEl.innerHTML = [
'<div class="carousel" data-bs-interval="false">',
@@ -510,7 +510,7 @@ describe('Carousel', () => {
it('should not slide when swiping and carousel is sliding', done => {
Simulator.setType('touch')
clearPointerEvents()
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
fixtureEl.innerHTML = [
'<div class="carousel" data-bs-interval="false">',
@@ -553,7 +553,7 @@ describe('Carousel', () => {
it('should not allow pinch with touch events', done => {
Simulator.setType('touch')
clearPointerEvents()
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
fixtureEl.innerHTML = '<div class="carousel" data-bs-interval="false"></div>'
@@ -978,7 +978,7 @@ describe('Carousel', () => {
const carouselEl = fixtureEl.querySelector('#myCarousel')
const carousel = new Carousel(carouselEl)
- carousel._interval = setInterval(() => {}, 10)
+ carousel._interval = setInterval(noop, 10)
spyOn(window, 'setInterval').and.callThrough()
spyOn(window, 'clearInterval').and.callThrough()
@@ -1175,7 +1175,7 @@ describe('Carousel', () => {
const carouselEl = fixtureEl.querySelector('div')
const carousel = new Carousel(carouselEl, {})
- expect(util.isRTL()).toEqual(true, 'rtl has to be true')
+ expect(isRTL()).toEqual(true, 'rtl has to be true')
expect(carousel._directionToOrder('left')).toEqual('prev')
expect(carousel._directionToOrder('prev')).toEqual('prev')
@@ -1243,7 +1243,7 @@ describe('Carousel', () => {
// Headless browser does not support touch events, so need to fake it
// to test that touch events are add/removed properly.
- document.documentElement.ontouchstart = () => {}
+ document.documentElement.ontouchstart = noop
const carousel = new Carousel(carouselEl)