From 297c47c3fdbb58e3d9824afdee83ef3c4b9d141a Mon Sep 17 00:00:00 2001 From: Johann Date: Fri, 2 Dec 2016 18:52:19 +0100 Subject: [V4] Throw error when a plugin is in transition (#17823) * Throw error when a plugin is in transition * Add unit tests about plugins in transition --- js/tests/visual/carousel.html | 24 ++++++++++++++++++++++-- js/tests/visual/collapse.html | 25 +++++++++++++++++++++++++ js/tests/visual/modal.html | 21 +++++++++++++++++++++ js/tests/visual/tooltip.html | 19 +++++++++++++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) (limited to 'js/tests') diff --git a/js/tests/visual/carousel.html b/js/tests/visual/carousel.html index 2017f338b..b26fb4a0d 100644 --- a/js/tests/visual/carousel.html +++ b/js/tests/visual/carousel.html @@ -46,11 +46,31 @@ diff --git a/js/tests/visual/collapse.html b/js/tests/visual/collapse.html index e13597984..973d3c5ee 100644 --- a/js/tests/visual/collapse.html +++ b/js/tests/visual/collapse.html @@ -61,5 +61,30 @@ + diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index fa5bd368a..69d392350 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -188,6 +188,26 @@ } } + // Should throw an error because modal is in transition + function testModalTransitionError() { + var err = false + // Close #myModal + $('#myModal').on('shown.bs.modal', function () { + $('#myModal').modal('hide').off('shown.bs.modal') + if (!err) { + alert('No error thrown for : testModalTransitionError') + } + }) + + try { + $('#myModal').modal('show').modal('hide') + } + catch (e) { + err = true + console.error(e.message) + } + } + $(function () { $('[data-toggle="popover"]').popover() $('[data-toggle="tooltip"]').tooltip() @@ -200,6 +220,7 @@ $('#firefoxModal').on('focus', reportFirefoxTestResult.bind(false)) $('#ff-bug-input').on('focus', reportFirefoxTestResult.bind(true)) }) + testModalTransitionError() }) diff --git a/js/tests/visual/tooltip.html b/js/tests/visual/tooltip.html index 999e7eda6..6cd33e7e6 100644 --- a/js/tests/visual/tooltip.html +++ b/js/tests/visual/tooltip.html @@ -42,7 +42,26 @@ -- cgit v1.2.3 From bf39bb3ac3d2aef4687b3cd4762015d5f218e2bc Mon Sep 17 00:00:00 2001 From: Starsam80 Date: Thu, 27 Oct 2016 16:13:17 -0600 Subject: Rename `.active` to `.show` --- js/tests/unit/alert.js | 6 +++--- js/tests/unit/collapse.js | 32 ++++++++++++++++---------------- js/tests/unit/dropdown.js | 34 +++++++++++++++++----------------- js/tests/unit/popover.js | 2 +- js/tests/unit/tooltip.js | 40 ++++++++++++++++++++-------------------- js/tests/visual/alert.html | 6 +++--- js/tests/visual/collapse.html | 2 +- js/tests/visual/modal.html | 2 +- 8 files changed, 62 insertions(+), 62 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js index 9548c3318..e078082c3 100644 --- a/js/tests/unit/alert.js +++ b/js/tests/unit/alert.js @@ -34,7 +34,7 @@ $(function () { QUnit.test('should fade element out on clicking .close', function (assert) { assert.expect(1) - var alertHTML = '
' + var alertHTML = '
' + '×' + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' + '
' @@ -43,12 +43,12 @@ $(function () { $alert.find('.close').trigger('click') - assert.strictEqual($alert.hasClass('active'), false, 'remove .active class on .close click') + assert.strictEqual($alert.hasClass('show'), false, 'remove .show class on .close click') }) QUnit.test('should remove element when clicking .close', function (assert) { assert.expect(2) - var alertHTML = '
' + var alertHTML = '
' + '×' + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' + '
' diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index 7db69e2cf..713930433 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -48,7 +48,7 @@ $(function () { assert.expect(2) var $el = $('
').bootstrapCollapse('show') - assert.ok($el.hasClass('active'), 'has class "active"') + assert.ok($el.hasClass('show'), 'has class "show"') assert.ok(!/height/i.test($el.attr('style')), 'has height reset') }) @@ -62,7 +62,7 @@ $(function () { '
', '
', '
', - '
', + '
', '
', '
' ].join('') @@ -71,15 +71,15 @@ $(function () { var $el2 = $('#collapse2') $el1.bootstrapCollapse('show') - assert.ok($el1.hasClass('active')) - assert.ok($el2.hasClass('active')) + assert.ok($el1.hasClass('show')) + assert.ok($el2.hasClass('show')) }) QUnit.test('should hide a collapsed element', function (assert) { assert.expect(1) var $el = $('
').bootstrapCollapse('hide') - assert.ok(!$el.hasClass('active'), 'does not have class "active"') + assert.ok(!$el.hasClass('show'), 'does not have class "show"') }) QUnit.test('should not fire shown when show is prevented', function (assert) { @@ -150,7 +150,7 @@ $(function () { var $target = $('').appendTo('#qunit-fixture') - $('
') + $('
') .appendTo('#qunit-fixture') .on('hidden.bs.collapse', function () { assert.ok($target.hasClass('collapsed'), 'target has collapsed class') @@ -185,7 +185,7 @@ $(function () { var $target = $('').appendTo('#qunit-fixture') var $alt = $('').appendTo('#qunit-fixture') - $('
') + $('
') .appendTo('#qunit-fixture') .on('hidden.bs.collapse', function () { assert.ok($target.hasClass('collapsed'), 'target has collapsed class') @@ -200,7 +200,7 @@ $(function () { assert.expect(0) var done = assert.async() - var $test = $('
') + var $test = $('
') .appendTo('#qunit-fixture') .on('hide.bs.collapse', function () { assert.ok(false) @@ -244,7 +244,7 @@ $(function () { assert.expect(1) var done = assert.async() - $('
') + $('
') .appendTo('#qunit-fixture') .on('hide.bs.collapse', function () { assert.ok(true, 'hiding a previously-uninitialized shown collapse when the "hide" method is called') @@ -267,7 +267,7 @@ $(function () { var $target1 = $('
').appendTo($groups.eq(0)) - $('
').appendTo($groups.eq(0)) + $('
').appendTo($groups.eq(0)) var $target2 = $('').appendTo($groups.eq(0)) - $('
').appendTo($groups.eq(0)) + $('
').appendTo($groups.eq(0)) var $target2 = $('').appendTo('#qunit-fixture') - $('
') + $('
') .appendTo('#qunit-fixture') .on('hidden.bs.collapse', function () { assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"') @@ -379,7 +379,7 @@ $(function () { var $target = $('').appendTo('#qunit-fixture') var $alt = $('').appendTo('#qunit-fixture') - $('
') + $('
') .appendTo('#qunit-fixture') .on('hidden.bs.collapse', function () { assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"') @@ -403,7 +403,7 @@ $(function () { var $target1 = $('').appendTo($groups.eq(0)) - $('
').appendTo($groups.eq(0)) + $('
').appendTo($groups.eq(0)) var $target2 = $('').appendTo('#qunit-fixture') - $('
') + $('
') .appendTo('#qunit-fixture') .on('hidden.bs.collapse', function () { assert.ok($target.hasClass('collapsed')) diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 7e8ecae4e..53455c2a6 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -59,7 +59,7 @@ $(function () { + '' var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click') - assert.ok(!$dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click') + assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click') }) QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) { @@ -128,10 +128,10 @@ $(function () { + '' var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click') - assert.ok(!$dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click') + assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click') }) - QUnit.test('should add class active to menu if clicked', function (assert) { + QUnit.test('should add class show to menu if clicked', function (assert) { assert.expect(1) var dropdownHTML = '
    ' + '
' var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click') - assert.ok($dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click') + assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click') }) QUnit.test('should test if element has a # before assuming it\'s a selector', function (assert) { @@ -164,11 +164,11 @@ $(function () { + '' var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click') - assert.ok($dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click') + assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click') }) - QUnit.test('should remove "active" class if body is clicked', function (assert) { + QUnit.test('should remove "show" class if body is clicked', function (assert) { assert.expect(2) var dropdownHTML = '
    ' + '
- - + + diff --git a/js/tests/visual/scrollspy.html b/js/tests/visual/scrollspy.html index 337611126..58c92296d 100644 --- a/js/tests/visual/scrollspy.html +++ b/js/tests/visual/scrollspy.html @@ -84,7 +84,7 @@

Ad leggings keytar, brunch id art party dolor labore.

- + diff --git a/js/tests/visual/tab.html b/js/tests/visual/tab.html index 14481cac5..5d1ee5730 100644 --- a/js/tests/visual/tab.html +++ b/js/tests/visual/tab.html @@ -165,7 +165,7 @@
- + diff --git a/js/tests/visual/tooltip.html b/js/tests/visual/tooltip.html index 6cd33e7e6..667481df4 100644 --- a/js/tests/visual/tooltip.html +++ b/js/tests/visual/tooltip.html @@ -34,8 +34,8 @@

- - + + -- cgit v1.2.3 From d935cca9f6d694907ce0acca3703e62d973938c0 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 30 Dec 2016 22:29:58 -0800 Subject: one more test file --- js/tests/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tests') diff --git a/js/tests/index.html b/js/tests/index.html index e4cbae42f..179ceb77e 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -6,8 +6,8 @@ - - + + -- cgit v1.2.3 From e2b6badb86571d482c9653e05cedda10aae12127 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 31 Dec 2016 12:20:32 -0800 Subject: v4: Rip out IE compatibility mode meta tags (#21483) * Remove IE compatibility mode meta tag from docs, examples, and JS tests as we no longer support IE9 and IE8 * update and remove some IE bits from our supported browser page * update introduction.md to match * reword starter template intro --- js/tests/visual/alert.html | 1 - js/tests/visual/button.html | 1 - js/tests/visual/carousel.html | 1 - js/tests/visual/collapse.html | 1 - js/tests/visual/dropdown.html | 1 - js/tests/visual/modal.html | 1 - js/tests/visual/popover.html | 1 - js/tests/visual/scrollspy.html | 1 - js/tests/visual/tab.html | 1 - js/tests/visual/tooltip.html | 1 - 10 files changed, 10 deletions(-) (limited to 'js/tests') diff --git a/js/tests/visual/alert.html b/js/tests/visual/alert.html index 43ca17ec4..5425b3507 100644 --- a/js/tests/visual/alert.html +++ b/js/tests/visual/alert.html @@ -3,7 +3,6 @@ - Alert diff --git a/js/tests/visual/button.html b/js/tests/visual/button.html index 8e1564979..79cfa0248 100644 --- a/js/tests/visual/button.html +++ b/js/tests/visual/button.html @@ -3,7 +3,6 @@ - Button diff --git a/js/tests/visual/carousel.html b/js/tests/visual/carousel.html index c4d646870..b02d28a05 100644 --- a/js/tests/visual/carousel.html +++ b/js/tests/visual/carousel.html @@ -3,7 +3,6 @@ - Carousel diff --git a/js/tests/visual/collapse.html b/js/tests/visual/collapse.html index b9269b31d..d16a1b0f2 100644 --- a/js/tests/visual/collapse.html +++ b/js/tests/visual/collapse.html @@ -3,7 +3,6 @@ - Collapse diff --git a/js/tests/visual/dropdown.html b/js/tests/visual/dropdown.html index 1929669c7..6888cdb15 100644 --- a/js/tests/visual/dropdown.html +++ b/js/tests/visual/dropdown.html @@ -3,7 +3,6 @@ - Dropdown diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index 2b8bf4b85..33af36c5f 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -3,7 +3,6 @@ - Modal -
-
+ +

@fat

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

diff --git a/js/tests/visual/tab.html b/js/tests/visual/tab.html index 07f79973b..e747302db 100644 --- a/js/tests/visual/tab.html +++ b/js/tests/visual/tab.html @@ -71,7 +71,7 @@
-
+

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

@@ -178,7 +178,7 @@
-
+

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

@@ -196,42 +196,34 @@
-

Tabs with list group (with fade)

- -
-
-

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

-

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

-
-

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

-

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

-
-
-

Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.

-

Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.

-
-
-

Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.

-

Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.

+
+
- -- cgit v1.2.3 From a14451deb3b8368de76aad6e728b27032bf8097a Mon Sep 17 00:00:00 2001 From: Ilias Date: Sun, 2 Apr 2017 14:26:25 +0300 Subject: Fix #18373: properly adjust padding-right of body and fixed elements when opening or closing modal --- js/tests/unit/modal.js | 123 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 95 insertions(+), 28 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 84492cec2..2c3e42230 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -9,6 +9,10 @@ $(function () { }) QUnit.module('modal', { + before: function () { + // Enable the scrollbar measurer + $('').appendTo('head') + }, beforeEach: function () { // Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode $.fn.bootstrapModal = $.fn.modal.noConflict() @@ -336,81 +340,144 @@ $(function () { $toggleBtn.trigger('click') }) - QUnit.test('should restore inline body padding after closing', function (assert) { + QUnit.test('should adjust the inline body padding when opening and restore when closing', function (assert) { assert.expect(2) var done = assert.async() - var originalBodyPad = 0 var $body = $(document.body) - - $body.css('padding-right', originalBodyPad) + var originalPadding = $body.css('padding-right') $('