From a260967a55806a26bee15a5c1eb890c9e6a3ba02 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 8 Oct 2021 12:32:11 +0300 Subject: [PATCH] tests: minor cleanup (#35138) * tests: minor cleanup * tests: use the util noop function --- js/tests/unit/alert.spec.js | 2 -- js/tests/unit/button.spec.js | 8 +------- js/tests/unit/carousel.spec.js | 24 +++++++++++------------ js/tests/unit/collapse.spec.js | 2 -- js/tests/unit/dom/data.spec.js | 5 ++--- js/tests/unit/dom/event-handler.spec.js | 2 -- js/tests/unit/dom/manipulator.spec.js | 2 -- js/tests/unit/dom/selector-engine.spec.js | 2 -- js/tests/unit/dropdown.spec.js | 8 +++----- js/tests/unit/jquery.spec.js | 3 +-- js/tests/unit/modal.spec.js | 2 -- js/tests/unit/offcanvas.spec.js | 4 +--- js/tests/unit/popover.spec.js | 2 -- js/tests/unit/scrollspy.spec.js | 2 -- js/tests/unit/tab.spec.js | 2 -- js/tests/unit/toast.spec.js | 2 -- js/tests/unit/tooltip.spec.js | 2 -- js/tests/unit/util/index.spec.js | 2 -- 18 files changed, 19 insertions(+), 57 deletions(-) diff --git a/js/tests/unit/alert.spec.js b/js/tests/unit/alert.spec.js index 72cd23d89e..cdda997c90 100644 --- a/js/tests/unit/alert.spec.js +++ b/js/tests/unit/alert.spec.js @@ -1,7 +1,5 @@ import Alert from '../../src/alert' import { getTransitionDurationFromElement } from '../../src/util/index' - -/** Test helpers */ import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture' describe('Alert', () => { diff --git a/js/tests/unit/button.spec.js b/js/tests/unit/button.spec.js index be99177e87..e24ff5cb0f 100644 --- a/js/tests/unit/button.spec.js +++ b/js/tests/unit/button.spec.js @@ -1,11 +1,5 @@ import Button from '../../src/button' - -/** Test helpers */ -import { - getFixture, - clearFixture, - jQueryMock -} from '../helpers/fixture' +import { getFixture, clearFixture, jQueryMock } from '../helpers/fixture' describe('Button', () => { let fixtureEl diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js index 9e5cfea862..70b9b8f0f5 100644 --- a/js/tests/unit/carousel.spec.js +++ b/js/tests/unit/carousel.spec.js @@ -1,9 +1,7 @@ import Carousel from '../../src/carousel' 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/index' describe('Carousel', () => { const { Simulator, PointerEvent } = window @@ -331,7 +329,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 +342,7 @@ describe('Carousel', () => { return } - document.documentElement.ontouchstart = () => {} + document.documentElement.ontouchstart = noop document.head.append(stylesCarousel) Simulator.setType('pointer') @@ -389,7 +387,7 @@ describe('Carousel', () => { return } - document.documentElement.ontouchstart = () => {} + document.documentElement.ontouchstart = noop document.head.append(stylesCarousel) Simulator.setType('pointer') @@ -431,7 +429,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 = [ '