.on(Event.MOUSELEAVE, (event) => this.cycle(event))
}
- this._addTouchEventListeners()
+ if (this._config.touch) {
+ this._addTouchEventListeners()
+ }
}
_addTouchEventListeners() {
$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 = '<div id="myCarousel" class="carousel slide" data-interval="50" style="display: none;">' +
}, 80)
})
- QUnit.test('Should not go to the next item when the parent of the carousel is not visible', function (assert) {
+ QUnit.test('should not go to the next item when the parent of the carousel is not visible', function (assert) {
assert.expect(2)
var done = assert.async()
var html = '<div id="parent" style="display: none;">' +
done()
}, 5)
})
+
+ QUnit.test('should not add touch event listeners when touch option set to false', function (assert) {
+ assert.expect(1)
+
+ var spy = sinon.spy(Carousel.prototype, '_addTouchEventListeners')
+ var $carousel = $('<div class="carousel" data-ride="carousel" data-touch="false"></div>')
+
+ $carousel.appendTo('#qunit-fixture')
+ $carousel.bootstrapCarousel()
+
+ assert.strictEqual(spy.called, false)
+ spy.restore()
+ })
})