diff options
| author | Johann-S <[email protected]> | 2018-10-16 11:10:29 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2018-10-20 15:32:09 +0300 |
| commit | b1dc6b324c33bc6a4b0cb2dc06939136e32d0e0c (patch) | |
| tree | 4d6bf5747a6b072aef3f14e0d1bab796b7b11a5d /js/tests | |
| parent | 8883ccb205abfe975b4cacca8fbc22cf67092eb0 (diff) | |
| download | bootstrap-b1dc6b324c33bc6a4b0cb2dc06939136e32d0e0c.tar.xz bootstrap-b1dc6b324c33bc6a4b0cb2dc06939136e32d0e0c.zip | |
avoid drag img
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/carousel.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index bafd45fe7..d7d9ad250 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -4,17 +4,15 @@ $(function () { window.Carousel = typeof bootstrap !== 'undefined' ? bootstrap.Carousel : Carousel var originWinPointerEvent = window.PointerEvent - var originMsPointerEvent = window.MSPointerEvent + window.MSPointerEvent = null var supportPointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent) function clearPointerEvents() { window.PointerEvent = null - window.MSPointerEvent = null } function restorePointerEvents() { window.PointerEvent = originWinPointerEvent - window.MSPointerEvent = originMsPointerEvent } var stylesCarousel = [ @@ -1032,11 +1030,11 @@ $(function () { return } + document.documentElement.ontouchstart = $.noop Simulator.setType('pointer') assert.expect(3) var $styles = $(stylesCarousel).appendTo('head') var done = assert.async() - document.documentElement.ontouchstart = $.noop var carouselHTML = '<div class="carousel" data-interval="false">' + @@ -1050,8 +1048,7 @@ $(function () { ' </div>' + '</div>' - var $carousel = $(carouselHTML) - $carousel.appendTo('#qunit-fixture') + var $carousel = $(carouselHTML).appendTo('#qunit-fixture') var $item = $('#item') $carousel.bootstrapCarousel() var carousel = $carousel.data('bs.carousel') @@ -1061,8 +1058,8 @@ $(function () { assert.ok(true, 'slid event fired') assert.ok($item.hasClass('active')) assert.ok(spy.called) - delete document.documentElement.ontouchstart $styles.remove() + delete document.documentElement.ontouchstart done() }) @@ -1075,6 +1072,7 @@ $(function () { QUnit.test('should allow swiperight and call prev with touch events', function (assert) { Simulator.setType('touch') clearPointerEvents() + assert.expect(3) var done = assert.async() document.documentElement.ontouchstart = $.noop @@ -1119,12 +1117,12 @@ $(function () { return } + document.documentElement.ontouchstart = $.noop assert.expect(3) Simulator.setType('pointer') var $styles = $(stylesCarousel).appendTo('head') var done = assert.async() - document.documentElement.ontouchstart = $.noop var carouselHTML = '<div class="carousel" data-interval="false">' + @@ -1150,6 +1148,7 @@ $(function () { assert.ok(!$item.hasClass('active')) assert.ok(spy.called) $styles.remove() + delete document.documentElement.ontouchstart done() }) @@ -1164,9 +1163,9 @@ $(function () { assert.expect(3) clearPointerEvents() Simulator.setType('touch') + document.documentElement.ontouchstart = $.noop var done = assert.async() - document.documentElement.ontouchstart = $.noop var carouselHTML = '<div class="carousel" data-interval="false">' + @@ -1192,6 +1191,7 @@ $(function () { assert.ok(!$item.hasClass('active')) assert.ok(spy.called) restorePointerEvents() + delete document.documentElement.ontouchstart done() }) @@ -1205,6 +1205,7 @@ $(function () { QUnit.test('should not allow pinch with touch events', function (assert) { assert.expect(0) clearPointerEvents() + Simulator.setType('touch') var done = assert.async() document.documentElement.ontouchstart = $.noop @@ -1221,6 +1222,7 @@ $(function () { touches: 2 }, function () { restorePointerEvents() + delete document.documentElement.ontouchstart done() }) }) |
