]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
tests: switch to strictEqual/notStrictEqual
authorXhmikosR <xhmikosr@gmail.com>
Fri, 8 May 2020 13:36:20 +0000 (16:36 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Tue, 12 May 2020 16:21:36 +0000 (19:21 +0300)
js/tests/unit/alert.js
js/tests/unit/modal.js
js/tests/unit/popover.js
js/tests/unit/tooltip.js
js/tests/unit/util.js

index 65a8f9e76754385d004e1cf781d85ead91fa48ef..0d89d5f53d5be1ffe99bb4a5a56d8eb727be8a16 100644 (file)
@@ -56,7 +56,7 @@ $(function () {
         '</div>'
     var $alert = $(alertHTML).appendTo('#qunit-fixture').bootstrapAlert()
 
-    assert.notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
+    assert.notStrictEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
 
     $alert
       .one('closed.bs.alert', function () {
index 14cebe84f3745569b258ba17f44929182e2dfee2..95c3340328a0c3e4381f132f4d700f1b60f51060 100644 (file)
@@ -68,7 +68,7 @@ $(function () {
 
     $('<div id="modal-test"/>')
       .on('shown.bs.modal', function () {
-        assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
+        assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
         done()
       })
       .bootstrapModal('show')
@@ -109,7 +109,7 @@ $(function () {
     $('<div id="modal-test"/>')
       .on('shown.bs.modal', function () {
         assert.ok($('#modal-test').is(':visible'), 'modal visible')
-        assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
+        assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
         $(this).bootstrapModal('hide')
       })
       .on('hidden.bs.modal', function () {
@@ -126,7 +126,7 @@ $(function () {
     $('<div id="modal-test"/>')
       .on('shown.bs.modal', function () {
         assert.ok($('#modal-test').is(':visible'), 'modal visible')
-        assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
+        assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
         $(this).bootstrapModal('toggle')
       })
       .on('hidden.bs.modal', function () {
@@ -143,7 +143,7 @@ $(function () {
     $('<div id="modal-test"><span class="close" data-dismiss="modal"/></div>')
       .on('shown.bs.modal', function () {
         assert.ok($('#modal-test').is(':visible'), 'modal visible')
-        assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
+        assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
         $(this).find('.close').trigger('click')
       })
       .on('hidden.bs.modal', function () {
@@ -175,7 +175,7 @@ $(function () {
 
     $('<div id="modal-test"><div class="contents"/></div>')
       .on('shown.bs.modal', function () {
-        assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
+        assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
         $('.contents').trigger('click')
         assert.ok($('#modal-test').is(':visible'), 'modal visible')
         $('#modal-test').trigger('click')
index f4b04ded57cb54b6cbba7eb71cdacf58f8809635..f4b29cc9e03e2123e53cb397715ec4574cac01c1 100644 (file)
@@ -51,7 +51,7 @@ $(function () {
     $('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>')
       .appendTo('#qunit-fixture')
       .on('shown.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         $(this).bootstrapPopover('hide')
       })
       .on('hidden.bs.popover', function () {
@@ -95,7 +95,7 @@ $(function () {
 
     $popover
       .one('shown.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         assert.strictEqual($('.popover .popover-header').text(), '@fat', 'title correctly inserted')
         assert.strictEqual($('.popover .popover-body').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
         $popover.bootstrapPopover('hide')
@@ -121,7 +121,7 @@ $(function () {
 
     $popover.bootstrapPopover('show')
 
-    assert.notEqual($('.popover').length, 0, 'popover inserted')
+    assert.notStrictEqual($('.popover').length, 0, 'popover inserted')
     assert.strictEqual($('.popover .popover-header').text(), '@glebm <3 writing tests', 'title inserted')
     assert.ok($.contains($('.popover').get(0), title), 'title node moved, not copied')
     // toLowerCase because IE8 will return <I>...</I>
@@ -142,7 +142,7 @@ $(function () {
 
     $popover.bootstrapPopover('show')
 
-    assert.notEqual($('.popover').length, 0, 'popover inserted')
+    assert.notStrictEqual($('.popover').length, 0, 'popover inserted')
     assert.strictEqual($('.popover .popover-header').text(), '@glebm <3 writing tests', 'title inserted')
     assert.ok(!$.contains($('.popover').get(0), title), 'title node copied, not moved')
     assert.strictEqual($('.popover .popover-body').html(), '¯\\_(ツ)_/¯', 'content inserted')
@@ -164,8 +164,8 @@ $(function () {
       })
 
     function popoverInserted() {
-      assert.notEqual($('.popover').length, 0, 'popover was inserted')
-      assert.equal($('.popover .popover-body').html(), $div[0].outerHTML, 'content correctly inserted')
+      assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
+      assert.strictEqual($('.popover .popover-body').html(), $div[0].outerHTML, 'content correctly inserted')
     }
 
     $popover
@@ -195,7 +195,7 @@ $(function () {
       .appendTo('#qunit-fixture')
       .bootstrapPopover()
       .one('shown.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         assert.strictEqual($('.popover .popover-header').text(), '@mdo', 'title correctly inserted')
         assert.strictEqual($('.popover .popover-body').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
         $popover.bootstrapPopover('hide')
@@ -217,7 +217,7 @@ $(function () {
         content: 'ignored content option'
       })
       .one('shown.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         assert.strictEqual($('.popover .popover-header').text(), '@mdo', 'title correctly inserted')
         assert.strictEqual($('.popover .popover-body').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
         $popover.bootstrapPopover('hide')
@@ -240,7 +240,7 @@ $(function () {
         template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"/><div class="content"><p/></div></div></div>'
       })
       .one('shown.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
         $popover.bootstrapPopover('hide')
       })
@@ -282,7 +282,7 @@ $(function () {
         trigger: 'click'
       })
       .one('shown.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         $div.find('a').trigger('click')
       })
       .one('hidden.bs.popover', function () {
@@ -352,7 +352,7 @@ $(function () {
     $('<a href="#">@Johann-S</a>')
       .appendTo('#qunit-fixture')
       .on('inserted.bs.popover', function () {
-        assert.notEqual($('.popover').length, 0, 'popover was inserted')
+        assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
         assert.ok(true, 'inserted event fired')
         done()
       })
index 2149a689163ebee2de93aad1e257d13f32885d41..45c66a7f630635f0b767e8dd7e82ba2c3a5a9d38 100644 (file)
@@ -141,7 +141,7 @@ $(function () {
 
     $tooltip
       .one('shown.bs.tooltip', function () {
-        assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
+        assert.notStrictEqual($('.tooltip b').length, 0, 'b tag was inserted')
         $tooltip.bootstrapTooltip('hide')
       })
       .one('hidden.bs.tooltip', function () {
@@ -163,7 +163,7 @@ $(function () {
 
     $tooltip
       .one('shown.bs.tooltip', function () {
-        assert.notEqual($('.tooltip').length, 0, 'tooltip inserted')
+        assert.notStrictEqual($('.tooltip').length, 0, 'tooltip inserted')
         assert.strictEqual($('.tooltip').text(), '<3 writing tests', 'title inserted')
         assert.ok(!$.contains($('.tooltip').get(0), title), 'title node copied, not moved')
         done()
@@ -184,7 +184,7 @@ $(function () {
 
     $tooltip
       .one('shown.bs.tooltip', function () {
-        assert.notEqual($('.tooltip').length, 0, 'tooltip inserted')
+        assert.notStrictEqual($('.tooltip').length, 0, 'tooltip inserted')
         assert.strictEqual($('.tooltip').text(), '<3 writing tests', 'title inserted')
         assert.ok($.contains($('.tooltip').get(0), title), 'title node moved, not copied')
         done()
@@ -244,7 +244,7 @@ $(function () {
     $('<div title="tooltip title"/>')
       .appendTo('#qunit-fixture')
       .on('inserted.bs.tooltip', function () {
-        assert.notEqual($('.tooltip').length, 0, 'tooltip was inserted')
+        assert.notStrictEqual($('.tooltip').length, 0, 'tooltip was inserted')
         assert.ok(true, 'inserted event fired')
         done()
       })
@@ -403,7 +403,7 @@ $(function () {
 
     $tooltip
       .one('shown.bs.tooltip', function () {
-        assert.notEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
+        assert.notStrictEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
         assert.strictEqual($('#qunit-fixture > .tooltip').length, 0, 'tooltip is not in parent')
         $tooltip.bootstrapTooltip('hide')
       })
@@ -843,7 +843,7 @@ $(function () {
     $.each(tests, function (idx, triggers) {
       for (var i = 0, len = triggers.length; i < len; i++) {
         $el.trigger(triggers[i])
-        assert.equal(i < len - 1, showingTooltip())
+        assert.strictEqual(i < len - 1, showingTooltip())
       }
     })
   })
index 18a05b269f3f711a232626a5bf1e050136a219db..20c1e6ba38858c3bcae50f2d63728b1365169f7c 100644 (file)
@@ -157,9 +157,9 @@ $(function () {
       mode: 'open'
     })
 
-    assert.equal(shadowRoot, Util.findShadowRoot(shadowRoot))
+    assert.strictEqual(shadowRoot, Util.findShadowRoot(shadowRoot))
     shadowRoot.innerHTML = '<button>Shadow Button</button>'
-    assert.equal(shadowRoot, Util.findShadowRoot(shadowRoot.firstChild))
+    assert.strictEqual(shadowRoot, Util.findShadowRoot(shadowRoot.firstChild))
   })
 
   QUnit.test('Util.findShadowRoot should return null when attachShadow is not available', function (assert) {
@@ -167,7 +167,7 @@ $(function () {
 
     var $div = $('<div id="test"></div>').appendTo($('#qunit-fixture'))
     if (!document.documentElement.attachShadow) {
-      assert.equal(null, Util.findShadowRoot($div[0]))
+      assert.strictEqual(null, Util.findShadowRoot($div[0]))
     } else {
       var sandbox = sinon.createSandbox()
 
@@ -176,7 +176,7 @@ $(function () {
         return $div
       })
 
-      assert.equal(null, Util.findShadowRoot($div[0]))
+      assert.strictEqual(null, Util.findShadowRoot($div[0]))
       sandbox.restore()
     }
   })