diff options
| author | Jacob <[email protected]> | 2014-10-02 20:09:20 -0700 |
|---|---|---|
| committer | Jacob <[email protected]> | 2014-10-02 20:09:20 -0700 |
| commit | b702889613295c8d257a3ea2c945a9fbae3973fb (patch) | |
| tree | 792d363c95fb13938cad406eed8474b46291e006 /js/tests | |
| parent | 64a74e93547da1784240e1172fcaf4cff4385e4b (diff) | |
| parent | c37c1a67438b3c682bac3787069eb33fefa6f154 (diff) | |
| download | bootstrap-b702889613295c8d257a3ea2c945a9fbae3973fb.tar.xz bootstrap-b702889613295c8d257a3ea2c945a9fbae3973fb.zip | |
Merge pull request #14626 from twbs/carousel-pause-hover-non-mobile
Only enable `pause: hover` for non-touch browsers
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/carousel.js | 22 |
1 files changed, 22 insertions, 0 deletions
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 = '<div id="myCarousel" class="carousel" data-interval="false" data-pause="hover">' + + '<div class="carousel-inner">' + + '<div id="first" class="item active">' + + '<img alt="">' + + '</div>' + + '<div id="second" class="item">' + + '<img alt="">' + + '</div>' + + '<div id="third" class="item">' + + '<img alt="">' + + '</div>' + + '</div>' + + '</div>' + 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') + }) + }) }) |
