diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index ebd127148..b0e2a395b 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -36,9 +36,9 @@ $(function () { QUnit.test('should toggle active', function (assert) { assert.expect(2) var $btn = $('') - assert.equal($btn.hasClass('active'), false, 'btn does not have active class') + assert.strictEqual($btn.hasClass('active'), false, 'btn does not have active class') $btn.bootstrapButton('toggle') - assert.ok($btn.hasClass('active'), 'btn has class active') + assert.strictEqual($btn.hasClass('active'), true, 'btn has class active') }) QUnit.test('should toggle active when btn children are clicked', function (assert) { @@ -48,9 +48,9 @@ $(function () { $btn .append($inner) .appendTo('#qunit-fixture') - assert.equal($btn.hasClass('active'), false, 'btn does not have active class') + assert.strictEqual($btn.hasClass('active'), false, 'btn does not have active class') $inner.trigger('click') - assert.ok($btn.hasClass('active'), 'btn has class active') + assert.strictEqual($btn.hasClass('active'), true, 'btn has class active') }) QUnit.test('should toggle aria-pressed', function (assert) { @@ -107,7 +107,7 @@ $(function () { $btn.appendTo('#qunit-fixture') $(window).trigger($.Event('load')) setTimeout(function () { - assert.ok($btn.hasClass('active'), 'button with aria-pressed="true" has been given class active') + assert.strictEqual($btn.hasClass('active'), true, 'button with aria-pressed="true" has been given class active') done() }, 5) }) @@ -125,7 +125,7 @@ $(function () { $(window).trigger($.Event('load')) setTimeout(function () { - assert.ok($btn.hasClass('active'), 'checked checkbox button has been given class active') + assert.strictEqual($btn.hasClass('active'), true, 'checked checkbox button has been given class active') done() }, 5) }) @@ -137,7 +137,7 @@ $(function () { $btn.appendTo('#qunit-fixture') $(window).trigger($.Event('load')) setTimeout(function () { - assert.equal($btn.hasClass('active'), false, 'button without aria-pressed="true" has had active class removed') + assert.strictEqual($btn.hasClass('active'), false, 'button without aria-pressed="true" has had active class removed') done() }, 5) }) @@ -155,7 +155,7 @@ $(function () { $(window).trigger($.Event('load')) setTimeout(function () { - assert.equal($btn.hasClass('active'), false, 'unchecked checkbox button has had active class removed') + assert.strictEqual($btn.hasClass('active'), false, 'unchecked checkbox button has had active class removed') done() }, 5) }) @@ -224,28 +224,28 @@ $(function () { var $btn1 = $group.children().eq(0) var $btn2 = $group.children().eq(1) - assert.ok($btn1.hasClass('active'), 'btn1 has active class') + assert.strictEqual($btn1.hasClass('active'), true, 'btn1 has active class') assert.ok($btn1.find('input').prop('checked'), 'btn1 is checked') - assert.equal($btn2.hasClass('active'), false, 'btn2 does not have active class') - assert.equal($btn2.find('input').prop('checked'), false, 'btn2 is not checked') + assert.strictEqual($btn2.hasClass('active'), false, 'btn2 does not have active class') + assert.strictEqual($btn2.find('input').prop('checked'), false, 'btn2 is not checked') $btn2.find('input').trigger('click') - assert.equal($btn1.hasClass('active'), false, 'btn1 does not have active class') - assert.equal($btn1.find('input').prop('checked'), false, 'btn1 is not checked') - assert.ok($btn2.hasClass('active'), 'btn2 has active class') + assert.strictEqual($btn1.hasClass('active'), false, 'btn1 does not have active class') + assert.strictEqual($btn1.find('input').prop('checked'), false, 'btn1 is not checked') + assert.strictEqual($btn2.hasClass('active'), true, 'btn2 has active class') assert.ok($btn2.find('input').prop('checked'), 'btn2 is checked') $btn2.find('input').trigger('click') // Clicking an already checked radio should not un-check it - assert.equal($btn1.hasClass('active'), false, 'btn1 does not have active class') - assert.equal($btn1.find('input').prop('checked'), false, 'btn1 is not checked') - assert.ok($btn2.hasClass('active'), 'btn2 has active class') + assert.strictEqual($btn1.hasClass('active'), false, 'btn1 does not have active class') + assert.strictEqual($btn1.find('input').prop('checked'), false, 'btn1 is not checked') + assert.strictEqual($btn2.hasClass('active'), true, 'btn2 has active class') assert.ok($btn2.find('input').prop('checked'), 'btn2 is checked') $btn1.bootstrapButton('toggle') - assert.ok($btn1.hasClass('active'), 'btn1 has active class') + assert.strictEqual($btn1.hasClass('active'), true, 'btn1 has active class') assert.ok($btn1.find('input').prop('checked'), 'btn1 prop is checked') assert.ok($btn1.find('input')[0].checked, 'btn1 is checked with jquery') - assert.equal($btn2.hasClass('active'), false, 'btn2 does not have active class') - assert.equal($btn2.find('input').prop('checked'), false, 'btn2 is not checked') - assert.equal($btn2.find('input')[0].checked, false, 'btn2 is not checked') + assert.strictEqual($btn2.hasClass('active'), false, 'btn2 does not have active class') + assert.strictEqual($btn2.find('input').prop('checked'), false, 'btn2 is not checked') + assert.strictEqual($btn2.find('input')[0].checked, false, 'btn2 is not checked') }) QUnit.test('should fire click event on input', function (assert) { @@ -319,10 +319,10 @@ $(function () { var $input = $btn.children().eq(0) assert.ok($btn.is(':not(.active)'), 'button is initially not active') - assert.equal($input.prop('checked'), false, 'checkbox is initially not checked') + assert.strictEqual($input.prop('checked'), false, 'checkbox is initially not checked') $btn[0].click() // fire a real click on the DOM node itself, not a click() on the jQuery object that just aliases to trigger('click') assert.ok($btn.is(':not(.active)'), 'button did not become active') - assert.equal($input.prop('checked'), false, 'checkbox did not get checked') + assert.strictEqual($input.prop('checked'), false, 'checkbox did not get checked') }) QUnit.test('should not set active class if inner hidden checkbox is disabled but author forgot to set disabled class on outer button', function (assert) { @@ -338,10 +338,10 @@ $(function () { var $input = $btn.children().eq(0) assert.ok($btn.is(':not(.active)'), 'button is initially not active') - assert.equal($input.prop('checked'), false, 'checkbox is initially not checked') + assert.strictEqual($input.prop('checked'), false, 'checkbox is initially not checked') $btn[0].click() // fire a real click on the DOM node itself, not a click() on the jQuery object that just aliases to trigger('click') assert.ok($btn.is(':not(.active)'), 'button did not become active') - assert.equal($input.prop('checked'), false, 'checkbox did not get checked') + assert.strictEqual($input.prop('checked'), false, 'checkbox did not get checked') }) QUnit.test('should correctly set checked state on input and active class on label when using structure', function (assert) { @@ -357,7 +357,7 @@ $(function () { var $input = $label.children().eq(0) assert.ok($label.is(':not(.active)'), 'label is initially not active') - assert.equal($input.prop('checked'), false, 'checkbox is initially not checked') + assert.strictEqual($input.prop('checked'), false, 'checkbox is initially not checked') $label[0].click() // fire a real click on the DOM node itself, not a click() on the jQuery object that just aliases to trigger('click') assert.ok($label.is('.active'), 'label is active after click') assert.ok($input.prop('checked'), 'checkbox is checked after click') @@ -376,7 +376,7 @@ $(function () { var $input = $btn.children().eq(0) assert.ok($btn.is(':not(.active)'), '
is initially not active') - assert.equal($input.prop('checked'), false, 'checkbox is initially not checked') + assert.strictEqual($input.prop('checked'), false, 'checkbox is initially not checked') $btn[0].click() // fire a real click on the DOM node itself, not a click() on the jQuery object that just aliases to trigger('click') assert.ok($btn.is('.active'), '
is active after click') assert.ok($input.prop('checked'), 'checkbox is checked after click') @@ -395,8 +395,8 @@ $(function () { var $input = $btn.children().eq(0) assert.ok($btn.is(':not(.active)'), '