From c37c1a67438b3c682bac3787069eb33fefa6f154 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Tue, 16 Sep 2014 06:02:27 +0200 Subject: Only enable `pause: hover` for non-touch browsers Fixes #11967. --- js/tests/unit/carousel.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'js/tests') diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index 3f9e61a34..64d214462 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -398,4 +398,26 @@ $(function () { strictEqual($template.find('.item')[1], $template.find('.active')[0], 'second item active') }) + + test('should only add mouseenter and mouseleave listeners when not on mobile', function () { + var isMobile = 'ontouchstart' in document.documentElement + var templateHTML = '' + var $template = $(templateHTML).bootstrapCarousel() + + $.each(['mouseover', 'mouseout'], function (i, type) { + strictEqual(type in $._data($template[0], 'events'), !isMobile, 'does' + (isMobile ? ' not' : '') + ' listen for ' + type + ' events') + }) + }) }) -- cgit v1.2.3