From d51ee0dcf1cd020d3c1ee6f32e0ddb6dd84b6735 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Mon, 14 Jan 2019 17:53:54 +0100 Subject: [PATCH] Fix Carousel's touch option to not add touch listeners when set to false (#28046) --- js/src/carousel.js | 4 +++- js/tests/unit/carousel.js | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/js/src/carousel.js b/js/src/carousel.js index a43d86b189..06c20b5093 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -268,7 +268,9 @@ class Carousel { .on(Event.MOUSELEAVE, (event) => this.cycle(event)) } - this._addTouchEventListeners() + if (this._config.touch) { + this._addTouchEventListeners() + } } _addTouchEventListeners() { diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index 6c28b67214..0d2a0f3271 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -948,7 +948,7 @@ $(function () { $textArea.trigger(eventKeyDown) }) - QUnit.test('Should not go to the next item when the carousel is not visible', function (assert) { + QUnit.test('should not go to the next item when the carousel is not visible', function (assert) { assert.expect(2) var done = assert.async() var html = '