diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js
index 0d89d5f53..c0ff5e4fb 100644
--- a/js/tests/unit/alert.js
+++ b/js/tests/unit/alert.js
@@ -104,18 +104,18 @@ $(function () {
var $el = $('
is initially not active')
- assert.ok(!$input.prop('checked'), 'checkbox is initially not checked')
+ assert.equal($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)'), '
is initially not active')
- assert.ok(!$input.prop('checked'), 'checkbox property is initially not checked')
- assert.ok(!$input[0].checked, 'checkbox is not checked by jquery after click')
+ assert.equal($input.prop('checked'), false, 'checkbox property is initially not checked')
+ assert.equal($input[0].checked, false, 'checkbox is not checked by jquery after click')
$btn.bootstrapButton('toggle')
assert.ok($btn.is('.active'), ' is active after click')
assert.ok($input.prop('checked'), 'checkbox property is checked after click')
@@ -416,10 +416,10 @@ $(function () {
var $input = $label.children().eq(0)
assert.ok($label.is(':not(.active)'), 'label is initially not active')
- assert.ok(!$input.prop('checked'), 'checkbox is initially not checked')
+ assert.equal($input.prop('checked'), false, 'checkbox is initially not checked')
$group[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(':not(.active)'), 'label is not active after click')
- assert.ok(!$input.prop('checked'), 'checkbox is not checked after click')
+ assert.equal($input.prop('checked'), false, 'checkbox is not checked after click')
})
QUnit.test('should not try and set checked property on an input of type="hidden"', function (assert) {
@@ -434,9 +434,9 @@ $(function () {
var $label = $group.children().eq(0)
var $input = $label.children().eq(0)
- assert.ok(!$input.prop('checked'), 'hidden input initially has no checked property')
+ assert.equal($input.prop('checked'), false, 'hidden input initially has no checked property')
$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(!$input.prop('checked'), 'hidden input does not have a checked property')
+ assert.equal($input.prop('checked'), false, 'hidden input does not have a checked property')
})
QUnit.test('should not try and set checked property on an input that is not a radio button or checkbox', function (assert) {
@@ -451,9 +451,9 @@ $(function () {
var $label = $group.children().eq(0)
var $input = $label.children().eq(0)
- assert.ok(!$input.prop('checked'), 'text input initially has no checked property')
+ assert.equal($input.prop('checked'), false, 'text input initially has no checked property')
$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(!$input.prop('checked'), 'text input does not have a checked property')
+ assert.equal($input.prop('checked'), false, 'text input does not have a checked property')
})
QUnit.test('dispose should remove data and the element', function (assert) {
@@ -462,18 +462,18 @@ $(function () {
var $el = $('
')
var $button = $el.bootstrapButton()
- assert.ok(typeof $button.data('bs.button') !== 'undefined')
+ assert.notStrictEqual(typeof $button.data('bs.button'), 'undefined')
$button.data('bs.button').dispose()
- assert.ok(typeof $button.data('bs.button') === 'undefined')
+ assert.strictEqual(typeof $button.data('bs.button'), 'undefined')
})
QUnit.test('should return button version', function (assert) {
assert.expect(1)
if (typeof Button !== 'undefined') {
- assert.ok(typeof Button.VERSION === 'string')
+ assert.strictEqual(typeof Button.VERSION, 'string')
} else {
assert.notOk()
}
diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js
index 3c3e203e5..0fef9f84e 100644
--- a/js/tests/unit/carousel.js
+++ b/js/tests/unit/carousel.js
@@ -93,7 +93,7 @@ $(function () {
message = error.message
}
- assert.ok(message === expectedMessage, 'correct error message')
+ assert.strictEqual(message, expectedMessage, 'correct error message')
config = {
keyboard: document.createElement('div')
@@ -106,7 +106,7 @@ $(function () {
message = error.message
}
- assert.ok(message === expectedMessage, 'correct error message')
+ assert.strictEqual(message, expectedMessage, 'correct error message')
})
QUnit.test('should not fire slid when slide is prevented', function (assert) {
@@ -160,8 +160,8 @@ $(function () {
})
.one('slid.bs.carousel', function () {
setTimeout(function () {
- assert.ok(!$carousel.find('.carousel-item:nth-child(1)').is('.active'), 'first item still active')
- assert.ok(!$carousel.find('.carousel-indicators li:nth-child(1)').is('.active'), 'first indicator still active')
+ assert.equal($carousel.find('.carousel-item:nth-child(1)').is('.active'), false, 'first item still active')
+ assert.equal($carousel.find('.carousel-indicators li:nth-child(1)').is('.active'), false, 'first indicator still active')
assert.ok($carousel.find('.carousel-item:nth-child(2)').is('.active'), 'second item active')
assert.ok($carousel.find('.carousel-indicators li:nth-child(2)').is('.active'), 'second indicator active')
done()
@@ -404,14 +404,14 @@ $(function () {
var done = assert.async()
$(template)
.on('slid.bs.carousel', function (e) {
- assert.ok(typeof e.from !== 'undefined', 'from present')
- assert.ok(typeof e.to !== 'undefined', 'to present')
+ assert.notStrictEqual(typeof e.from, 'undefined', 'from present')
+ assert.notStrictEqual(typeof e.to, 'undefined', 'to present')
$(this).off()
done()
})
.on('slide.bs.carousel', function (e) {
- assert.ok(typeof e.from !== 'undefined', 'from present')
- assert.ok(typeof e.to !== 'undefined', 'to present')
+ assert.notStrictEqual(typeof e.from, 'undefined', 'from present')
+ assert.notStrictEqual(typeof e.to, 'undefined', 'to present')
$(this).off('slide.bs.carousel')
})
.bootstrapCarousel('next')
@@ -1158,7 +1158,7 @@ $(function () {
$carousel.one('slid.bs.carousel', function () {
assert.ok(true, 'slid event fired')
- assert.ok(!$item.hasClass('active'))
+ assert.equal($item.hasClass('active'), false)
assert.ok(spy.called)
assert.strictEqual(carousel.touchDeltaX, 0)
$styles.remove()
@@ -1202,7 +1202,7 @@ $(function () {
$carousel.one('slid.bs.carousel', function () {
assert.ok(true, 'slid event fired')
- assert.ok(!$item.hasClass('active'))
+ assert.equal($item.hasClass('active'), false)
assert.ok(spy.called)
assert.strictEqual(carousel.touchDeltaX, 0)
restorePointerEvents()
diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js
index 293c7cada..50956b0ad 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -51,7 +51,7 @@ $(function () {
$el.one('shown.bs.collapse', function () {
assert.ok($el.hasClass('show'), 'has class "show"')
- assert.ok(!/height/i.test($el.attr('style')), 'has height reset')
+ assert.equal(/height/i.test($el.attr('style')), false, 'has height reset')
done()
}).bootstrapCollapse('show')
})
@@ -64,11 +64,11 @@ $(function () {
var $el2 = $('
').appendTo('#qunit-fixture')
$el.one('shown.bs.collapse', function () {
assert.ok($el.hasClass('show'), 'has class "show"')
- assert.ok(!/height/i.test($el.attr('style')), 'has height reset')
+ assert.equal(/height/i.test($el.attr('style')), false, 'has height reset')
})
$el2.one('shown.bs.collapse', function () {
assert.ok($el2.hasClass('show'), 'has class "show"')
- assert.ok(!/height/i.test($el2.attr('style')), 'has height reset')
+ assert.equal(/height/i.test($el2.attr('style')), false, 'has height reset')
done()
})
$target.trigger('click')
@@ -103,7 +103,7 @@ $(function () {
assert.expect(1)
var $el = $('
').bootstrapCollapse('hide')
- assert.ok(!$el.hasClass('show'), 'does not have class "show"')
+ assert.equal($el.hasClass('show'), false, 'does not have class "show"')
})
QUnit.test('should not fire shown when show is prevented', function (assert) {
@@ -161,7 +161,7 @@ $(function () {
$('
')
.appendTo('#qunit-fixture')
.on('shown.bs.collapse', function () {
- assert.ok(!$target.hasClass('collapsed'), 'target does not have collapsed class')
+ assert.equal($target.hasClass('collapsed'), false, 'target does not have collapsed class')
done()
})
@@ -194,8 +194,8 @@ $(function () {
$('
')
.appendTo('#qunit-fixture')
.on('shown.bs.collapse', function () {
- assert.ok(!$target.hasClass('collapsed'), 'target trigger does not have collapsed class')
- assert.ok(!$alt.hasClass('collapsed'), 'alt trigger does not have collapsed class')
+ assert.equal($target.hasClass('collapsed'), false, 'target trigger does not have collapsed class')
+ assert.equal($alt.hasClass('collapsed'), false, 'alt trigger does not have collapsed class')
done()
})
@@ -304,7 +304,7 @@ $(function () {
.on('shown.bs.collapse', function () {
assert.ok($target1.hasClass('collapsed'), 'inactive target 1 does have class "collapsed"')
assert.ok($target2.hasClass('collapsed'), 'inactive target 2 does have class "collapsed"')
- assert.ok(!$target3.hasClass('collapsed'), 'active target 3 does not have class "collapsed"')
+ assert.equal($target3.hasClass('collapsed'), false, 'active target 3 does not have class "collapsed"')
done()
})
@@ -338,7 +338,7 @@ $(function () {
.on('shown.bs.collapse', function () {
assert.ok($target1.hasClass('collapsed'), 'inactive target 1 does have class "collapsed"')
assert.ok($target2.hasClass('collapsed'), 'inactive target 2 does have class "collapsed"')
- assert.ok(!$target3.hasClass('collapsed'), 'active target 3 does not have class "collapsed"')
+ assert.equal($target3.hasClass('collapsed'), false, 'active target 3 does not have class "collapsed"')
done()
})
@@ -479,7 +479,7 @@ $(function () {
$target1.trigger('click')
setTimeout(function () {
- assert.ok(!showFired, 'show event did not fire')
+ assert.equal(showFired, false, 'show event did not fire')
done()
}, 1)
})
@@ -508,7 +508,7 @@ $(function () {
$('
')
.appendTo('#qunit-fixture')
.on('shown.bs.collapse', function () {
- assert.ok(!$target.hasClass('collapsed'))
+ assert.equal($target.hasClass('collapsed'), false)
done()
})
.bootstrapCollapse('show')
@@ -535,9 +535,9 @@ $(function () {
var $collapseTwo = $('#collapseTwo')
$collapseOne.on('shown.bs.collapse', function () {
assert.ok($collapseOne.hasClass('show'), '#collapseOne is shown')
- assert.ok(!$collapseTwo.hasClass('show'), '#collapseTwo is not shown')
+ assert.equal($collapseTwo.hasClass('show'), false, '#collapseTwo is not shown')
$collapseTwo.on('shown.bs.collapse', function () {
- assert.ok(!$collapseOne.hasClass('show'), '#collapseOne is not shown')
+ assert.equal($collapseOne.hasClass('show'), false, '#collapseOne is not shown')
assert.ok($collapseTwo.hasClass('show'), '#collapseTwo is shown')
done()
})
@@ -573,9 +573,9 @@ $(function () {
var $collapseTwo = $('#collapseTwo')
$collapseOne.on('shown.bs.collapse', function () {
assert.ok($collapseOne.hasClass('show'), '#collapseOne is shown')
- assert.ok(!$collapseTwo.hasClass('show'), '#collapseTwo is not shown')
+ assert.equal($collapseTwo.hasClass('show'), false, '#collapseTwo is not shown')
$collapseTwo.on('shown.bs.collapse', function () {
- assert.ok(!$collapseOne.hasClass('show'), '#collapseOne is not shown')
+ assert.equal($collapseOne.hasClass('show'), false, '#collapseOne is not shown')
assert.ok($collapseTwo.hasClass('show'), '#collapseTwo is shown')
done()
})
@@ -611,14 +611,14 @@ $(function () {
function firstTest() {
assert.ok($collapseOneOne.hasClass('show'), '#collapseOneOne is shown')
assert.ok($collapseOneTwo.hasClass('show'), '#collapseOneTwo is shown')
- assert.ok(!$collapseTwoOne.hasClass('show'), '#collapseTwoOne is not shown')
- assert.ok(!$collapseTwoTwo.hasClass('show'), '#collapseTwoTwo is not shown')
+ assert.equal($collapseTwoOne.hasClass('show'), false, '#collapseTwoOne is not shown')
+ assert.equal($collapseTwoTwo.hasClass('show'), false, '#collapseTwoTwo is not shown')
$triggerTwo.trigger($.Event('click'))
}
function secondTest() {
- assert.ok(!$collapseOneOne.hasClass('show'), '#collapseOneOne is not shown')
- assert.ok(!$collapseOneTwo.hasClass('show'), '#collapseOneTwo is not shown')
+ assert.equal($collapseOneOne.hasClass('show'), false, '#collapseOneOne is not shown')
+ assert.equal($collapseOneTwo.hasClass('show'), false, '#collapseOneTwo is not shown')
assert.ok($collapseTwoOne.hasClass('show'), '#collapseTwoOne is shown')
assert.ok($collapseTwoTwo.hasClass('show'), '#collapseTwoTwo is shown')
done()
@@ -689,14 +689,14 @@ $(function () {
$collapseOne.one('shown.bs.collapse', function () {
assert.ok($collapseOne.hasClass('show'), '#collapseOne is shown')
- assert.ok(!$collapseTwo.hasClass('show'), '#collapseTwo is not shown')
- assert.ok(!$('#nestedCollapseOne').hasClass('show'), '#nestedCollapseOne is not shown')
+ assert.equal($collapseTwo.hasClass('show'), false, '#collapseTwo is not shown')
+ assert.equal($('#nestedCollapseOne').hasClass('show'), false, '#nestedCollapseOne is not shown')
$nestedCollapseOne.one('shown.bs.collapse', function () {
assert.ok($collapseOne.hasClass('show'), '#collapseOne is shown')
- assert.ok(!$collapseTwo.hasClass('show'), '#collapseTwo is not shown')
+ assert.equal($collapseTwo.hasClass('show'), false, '#collapseTwo is not shown')
assert.ok($nestedCollapseOne.hasClass('show'), '#nestedCollapseOne is shown')
$collapseTwo.one('shown.bs.collapse', function () {
- assert.ok(!$collapseOne.hasClass('show'), '#collapseOne is not shown')
+ assert.equal($collapseOne.hasClass('show'), false, '#collapseOne is not shown')
assert.ok($collapseTwo.hasClass('show'), '#collapseTwo is shown')
assert.ok($nestedCollapseOne.hasClass('show'), '#nestedCollapseOne is shown')
done()
@@ -717,7 +717,7 @@ $(function () {
.appendTo('#qunit-fixture')
.on('shown.bs.collapse', function () {
assert.ok($(this).hasClass('show'))
- assert.ok($target.attr('aria-expanded') === 'true')
+ assert.strictEqual($target.attr('aria-expanded'), 'true')
assert.ok($target.prop('checked'))
done()
})
@@ -737,13 +737,13 @@ $(function () {
var $target2 = $('
').appendTo('#qunit-fixture')
$target2.one('shown.bs.collapse', function () {
- assert.ok(!$trigger1.hasClass('collapsed'), 'trigger1 does not have collapsed class')
- assert.ok(!$trigger2.hasClass('collapsed'), 'trigger2 does not have collapsed class')
- assert.ok(!$trigger3.hasClass('collapsed'), 'trigger3 does not have collapsed class')
+ assert.equal($trigger1.hasClass('collapsed'), false, 'trigger1 does not have collapsed class')
+ assert.equal($trigger2.hasClass('collapsed'), false, 'trigger2 does not have collapsed class')
+ assert.equal($trigger3.hasClass('collapsed'), false, 'trigger3 does not have collapsed class')
$target2.one('hidden.bs.collapse', function () {
- assert.ok(!$trigger1.hasClass('collapsed'), 'trigger1 does not have collapsed class')
+ assert.equal($trigger1.hasClass('collapsed'), false, 'trigger1 does not have collapsed class')
assert.ok($trigger2.hasClass('collapsed'), 'trigger2 has collapsed class')
- assert.ok(!$trigger3.hasClass('collapsed'), 'trigger3 does not have collapsed class')
+ assert.equal($trigger3.hasClass('collapsed'), false, 'trigger3 does not have collapsed class')
$target1.one('hidden.bs.collapse', function () {
assert.ok($trigger1.hasClass('collapsed'), 'trigger1 has collapsed class')
assert.ok($trigger2.hasClass('collapsed'), 'trigger2 has collapsed class')
@@ -883,7 +883,7 @@ $(function () {
$collapse2.on('shown.bs.collapse', function () {
assert.ok($collapse2.hasClass('show'))
- assert.ok(!$('#collapse1').hasClass('show'))
+ assert.equal($('#collapse1').hasClass('show'), false)
done()
})
diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js
index e4b959ea1..482d32c5c 100644
--- a/js/tests/unit/dropdown.js
+++ b/js/tests/unit/dropdown.js
@@ -61,7 +61,7 @@ $(function () {
$(dropdownHTML).appendTo('#qunit-fixture')
var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
$dropdown.on('click', function () {
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false)
done()
})
$dropdown.trigger($.Event('click'))
@@ -88,7 +88,7 @@ $(function () {
$button.trigger('focus').trigger($.Event('keydown', {
which: 27
}))
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown after escape pressed')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is not shown after escape pressed')
done()
})
@@ -108,7 +108,7 @@ $(function () {
$dropdown
.parent('.dropdown')
.on('shown.bs.dropdown', function () {
- assert.ok(!$dropdown.parent('.dropdown').hasClass('position-static'), '"position-static" class not added')
+ assert.equal($dropdown.parent('.dropdown').hasClass('position-static'), false, '"position-static" class not added')
done()
})
$dropdown.trigger('click')
@@ -211,7 +211,7 @@ $(function () {
$(dropdownHTML).appendTo('#qunit-fixture')
var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
$dropdown.on('click', function () {
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false)
done()
})
$dropdown.trigger($.Event('click'))
@@ -266,7 +266,7 @@ $(function () {
assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
$(document.body).trigger('click')
}).on('hidden.bs.dropdown', function () {
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class removed')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, '"show" class removed')
done()
})
$dropdown.trigger('click')
@@ -298,7 +298,7 @@ $(function () {
e.which = 9 // Tab
$(document.body).trigger(e)
}).on('hidden.bs.dropdown', function () {
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class removed')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, '"show" class removed')
done()
})
$dropdown.trigger('click')
@@ -642,8 +642,8 @@ $(function () {
$dropdown.trigger($.Event('keydown', {
which: 40
}))
- assert.ok(!$(document.activeElement).is('.disabled'), '.disabled is not focused')
- assert.ok(!$(document.activeElement).is(':disabled'), ':disabled is not focused')
+ assert.equal($(document.activeElement).is('.disabled'), false, '.disabled is not focused')
+ assert.equal($(document.activeElement).is(':disabled'), false, ':disabled is not focused')
done()
})
$dropdown.trigger('click')
@@ -770,7 +770,7 @@ $(function () {
$triggerDropdown
.parent('.dropdown')
.on('shown.bs.dropdown', function () {
- assert.ok(typeof $dropdownMenu.attr('style') === 'undefined', 'No inline style applied by Popper')
+ assert.strictEqual(typeof $dropdownMenu.attr('style'), 'undefined', 'No inline style applied by Popper')
done()
})
$triggerDropdown.trigger($.Event('click'))
@@ -800,15 +800,15 @@ $(function () {
.on('shown.bs.dropdown', function () {
// Forcibly focus first item
$item[0].focus()
- assert.ok($(document.activeElement)[0] === $item[0], 'menu item initial focus set')
+ assert.strictEqual($(document.activeElement)[0], $item[0], 'menu item initial focus set')
// Key escape
$item.trigger('focus').trigger($.Event('keydown', {
which: 27
}))
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu was closed after escape')
- assert.ok($(document.activeElement)[0] === $toggle[0], 'toggle has focus again once menu was closed after escape')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu was closed after escape')
+ assert.strictEqual($(document.activeElement)[0], $toggle[0], 'toggle has focus again once menu was closed after escape')
done()
})
@@ -847,37 +847,37 @@ $(function () {
$input.trigger('focus').trigger($.Event('keydown', {
which: 32
}))
- assert.ok($(document.activeElement)[0] === $input[0], 'input still focused')
+ assert.strictEqual($(document.activeElement)[0], $input[0], 'input still focused')
$textarea.trigger('focus').trigger($.Event('keydown', {
which: 32
}))
- assert.ok($(document.activeElement)[0] === $textarea[0], 'textarea still focused')
+ assert.strictEqual($(document.activeElement)[0], $textarea[0], 'textarea still focused')
// Key up
$input.trigger('focus').trigger($.Event('keydown', {
which: 38
}))
- assert.ok($(document.activeElement)[0] === $input[0], 'input still focused')
+ assert.strictEqual($(document.activeElement)[0], $input[0], 'input still focused')
$textarea.trigger('focus').trigger($.Event('keydown', {
which: 38
}))
- assert.ok($(document.activeElement)[0] === $textarea[0], 'textarea still focused')
+ assert.strictEqual($(document.activeElement)[0], $textarea[0], 'textarea still focused')
// Key down
$input.trigger('focus').trigger($.Event('keydown', {
which: 40
}))
- assert.ok($(document.activeElement)[0] === $input[0], 'input still focused')
+ assert.strictEqual($(document.activeElement)[0], $input[0], 'input still focused')
$textarea.trigger('focus').trigger($.Event('keydown', {
which: 40
}))
- assert.ok($(document.activeElement)[0] === $textarea[0], 'textarea still focused')
+ assert.strictEqual($(document.activeElement)[0], $textarea[0], 'textarea still focused')
// Key escape
$input.trigger('focus').trigger($.Event('keydown', {
which: 27
}))
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is not shown')
done()
})
@@ -924,7 +924,7 @@ $(function () {
$input.trigger('focus').trigger($.Event('keydown', {
which: 27
}))
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is not shown')
$dropdown
.parent('.dropdown')
@@ -933,7 +933,7 @@ $(function () {
$input.trigger('focus').trigger($.Event('keydown', {
which: 40
}))
- assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')
+ assert.strictEqual(document.activeElement, $('#item1')[0], 'item1 is focused')
$dropdown
.parent('.dropdown')
@@ -942,7 +942,7 @@ $(function () {
$input.trigger('focus').trigger($.Event('keydown', {
which: 38
}))
- assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')
+ assert.strictEqual(document.activeElement, $('#item1')[0], 'item1 is focused')
done()
}).bootstrapDropdown('toggle')
$input.trigger('click')
@@ -992,7 +992,7 @@ $(function () {
$textarea.trigger('focus').trigger($.Event('keydown', {
which: 27
}))
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is not shown')
$dropdown
.parent('.dropdown')
@@ -1001,7 +1001,7 @@ $(function () {
$textarea.trigger('focus').trigger($.Event('keydown', {
which: 40
}))
- assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')
+ assert.strictEqual(document.activeElement, $('#item1')[0], 'item1 is focused')
$dropdown
.parent('.dropdown')
@@ -1010,7 +1010,7 @@ $(function () {
$textarea.trigger('focus').trigger($.Event('keydown', {
which: 38
}))
- assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')
+ assert.strictEqual(document.activeElement, $('#item1')[0], 'item1 is focused')
done()
}).bootstrapDropdown('toggle')
$textarea.trigger('click')
@@ -1187,15 +1187,15 @@ $(function () {
dropdown.toggle()
assert.ok(dropdown._popper)
- assert.ok(dropdown._menu !== null)
- assert.ok(dropdown._element !== null)
+ assert.notStrictEqual(dropdown._menu, null)
+ assert.notStrictEqual(dropdown._element, null)
var spyDestroy = sinon.spy(dropdown._popper, 'destroy')
dropdown.dispose()
assert.ok(spyDestroy.called)
- assert.ok(dropdown._menu === null)
- assert.ok(dropdown._element === null)
+ assert.strictEqual(dropdown._menu, null)
+ assert.strictEqual(dropdown._element, null)
})
QUnit.test('should dispose dropdown', function (assert) {
@@ -1217,13 +1217,13 @@ $(function () {
var dropdown = $dropdown.data('bs.dropdown')
assert.notOk(dropdown._popper)
- assert.ok(dropdown._menu !== null)
- assert.ok(dropdown._element !== null)
+ assert.notStrictEqual(dropdown._menu, null)
+ assert.notStrictEqual(dropdown._element, null)
dropdown.dispose()
- assert.ok(dropdown._menu === null)
- assert.ok(dropdown._element === null)
+ assert.strictEqual(dropdown._menu, null)
+ assert.strictEqual(dropdown._element, null)
})
QUnit.test('should show dropdown', function (assert) {
@@ -1284,7 +1284,7 @@ $(function () {
assert.ok(true, 'hide was fired')
})
.on('hidden.bs.dropdown', function () {
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is hidden')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is hidden')
done()
})
@@ -1332,7 +1332,7 @@ $(function () {
var dropdown = $dropdown.data('bs.dropdown')
dropdown.hide()
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is still hidden')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is still hidden')
})
QUnit.test('should show dropdown', function (assert) {
@@ -1357,7 +1357,7 @@ $(function () {
$dropdown
.parent('.dropdown')
.on('show.bs.dropdown', function () {
- assert.ok(dropdown._popper === null)
+ assert.strictEqual(dropdown._popper, null)
assert.ok(true, 'show was fired')
})
.on('shown.bs.dropdown', function () {
@@ -1395,7 +1395,7 @@ $(function () {
})
dropdown.show()
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is hidden')
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false, 'dropdown menu is hidden')
})
QUnit.test('should prevent default event on hide method call', function (assert) {
@@ -1441,7 +1441,7 @@ $(function () {
$(dropdownHTML).appendTo('#qunit-fixture')
var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
$dropdown.show()
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false)
})
QUnit.test('should not open dropdown via show method if target is disabled via class', function (assert) {
@@ -1457,7 +1457,7 @@ $(function () {
$(dropdownHTML).appendTo('#qunit-fixture')
var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
$dropdown.show()
- assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
+ assert.equal($dropdown.parent('.dropdown').hasClass('show'), false)
})
QUnit.test('should not hide dropdown via hide method if target is disabled via attribute', function (assert) {
@@ -1516,8 +1516,8 @@ $(function () {
var dropdown = $dropdown.data('bs.dropdown')
var offset = dropdown._getOffset()
- assert.ok(typeof offset.offset === 'undefined')
- assert.ok(typeof offset.fn === 'function')
+ assert.strictEqual(typeof offset.offset, 'undefined')
+ assert.strictEqual(typeof offset.fn, 'function')
})
QUnit.test('should create offset modifier correctly when offset option is not a function', function (assert) {
@@ -1543,7 +1543,7 @@ $(function () {
var offset = dropdown._getOffset()
assert.strictEqual(offset.offset, myOffset)
- assert.ok(typeof offset.fn === 'undefined')
+ assert.strictEqual(typeof offset.fn, 'undefined')
})
QUnit.test('should allow to pass config to Popper with `popperConfig`', function (assert) {
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index a46b3d2de..09cb09059 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -113,7 +113,7 @@ $(function () {
$(this).bootstrapModal('hide')
})
.on('hidden.bs.modal', function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
done()
})
.bootstrapModal('show')
@@ -130,7 +130,7 @@ $(function () {
$(this).bootstrapModal('toggle')
})
.on('hidden.bs.modal', function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
done()
})
.bootstrapModal('toggle')
@@ -147,7 +147,7 @@ $(function () {
$(this).find('.close').trigger('click')
})
.on('hidden.bs.modal', function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
done()
})
.bootstrapModal('toggle')
@@ -163,7 +163,7 @@ $(function () {
$(this).bootstrapModal('hide')
})
.on('hidden.bs.modal', function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
done()
})
.bootstrapModal('show')
@@ -181,7 +181,7 @@ $(function () {
$('#modal-test').trigger('click')
})
.on('hidden.bs.modal', function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
done()
})
.bootstrapModal('show')
@@ -214,7 +214,7 @@ $(function () {
}))
setTimeout(function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
$div.remove()
done()
}, 0)
@@ -324,13 +324,13 @@ $(function () {
})
.one('hidden.bs.modal', function () {
// After one open-close cycle
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
$(this)
.one('shown.bs.modal', function () {
$('#close').trigger('click')
})
.one('hidden.bs.modal', function () {
- assert.ok(!$('#modal-test').is(':visible'), 'modal hidden')
+ assert.equal($('#modal-test').is(':visible'), false, 'modal hidden')
done()
})
.bootstrapModal('show')
@@ -751,11 +751,11 @@ $(function () {
}
})
- assert.ok(typeof $(this).data('bs.modal') === 'undefined', 'modal data object was disposed')
+ assert.strictEqual(typeof $(this).data('bs.modal'), 'undefined', 'modal data object was disposed')
- assert.ok(spy.callCount === 4, '`jQuery.off` was called')
+ assert.strictEqual(spy.callCount, 4, '`jQuery.off` was called')
- assert.ok(modalDataApiEvent.length === 1, '`Event.CLICK_DATA_API` on `document` was not removed')
+ assert.strictEqual(modalDataApiEvent.length, 1, '`Event.CLICK_DATA_API` on `document` was not removed')
$.fn.off.restore()
done()
diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js
index 102f37f8d..c6ffdf88e 100644
--- a/js/tests/unit/popover.js
+++ b/js/tests/unit/popover.js
@@ -157,9 +157,9 @@ $(function () {
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.equal($.contains($('.popover').get(0), title), false, 'title node copied, not moved')
assert.strictEqual($('.popover .popover-body').html(), '¯\\_(ツ)_/¯', 'content inserted')
- assert.ok(!$.contains($('.popover').get(0), content), 'content node copied, not moved')
+ assert.equal($.contains($('.popover').get(0), content), false, 'content node copied, not moved')
})
QUnit.test('should not duplicate HTML object', function (assert) {
@@ -279,8 +279,8 @@ $(function () {
$popover.bootstrapPopover('show')
$popover.bootstrapPopover('dispose')
- assert.ok(!$popover.hasClass('show'), 'popover is hidden')
- assert.ok(!$popover.data('popover'), 'popover does not have data')
+ assert.equal($popover.hasClass('show'), false, 'popover is hidden')
+ assert.equal($popover.data('popover'), false, 'popover does not have data')
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover still has click.foo')
assert.ok(!$._data($popover[0], 'events').mouseover && !$._data($popover[0], 'events').mouseout, 'popover does not have any events')
})
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js
index 4628c79b2..a64f8768e 100644
--- a/js/tests/unit/scrollspy.js
+++ b/js/tests/unit/scrollspy.js
@@ -264,9 +264,9 @@ $(function () {
})
$scrollspy.one('scroll', function () {
- assert.ok(!$section.find('#one-link').hasClass('active'), '"active" class removed from first section')
+ assert.equal($section.find('#one-link').hasClass('active'), false, '"active" class removed from first section')
assert.ok($section.find('#two-link').hasClass('active'), '"active" class on middle section')
- assert.ok(!$section.find('#three-link').hasClass('active'), '"active" class not on last section')
+ assert.equal($section.find('#three-link').hasClass('active'), false, '"active" class not on last section')
done()
})
@@ -775,8 +775,8 @@ $(function () {
var $target = $('#div-' + type + 'm-2')
var scrollspy = $content.data('bs.scrollspy')
- assert.ok(scrollspy._offsets[1] === $target.offset().top, 'offset method with ' + type + ' option')
- assert.ok(scrollspy._offsets[1] !== $target.position().top, 'position method with ' + type + ' option')
+ assert.strictEqual(scrollspy._offsets[1], $target.offset().top, 'offset method with ' + type + ' option')
+ assert.notStrictEqual(scrollspy._offsets[1], $target.position().top, 'position method with ' + type + ' option')
$navbar.remove()
$content.remove()
}
@@ -822,8 +822,8 @@ $(function () {
var $target = $('#div-' + type + 'm-2')
var scrollspy = $content.data('bs.scrollspy')
- assert.ok(scrollspy._offsets[1] !== $target.offset().top, 'offset method with ' + type + ' option')
- assert.ok(scrollspy._offsets[1] === $target.position().top, 'position method with ' + type + ' option')
+ assert.notStrictEqual(scrollspy._offsets[1], $target.offset().top, 'offset method with ' + type + ' option')
+ assert.strictEqual(scrollspy._offsets[1], $target.position().top, 'position method with ' + type + ' option')
$navbar.remove()
$content.remove()
}
diff --git a/js/tests/unit/toast.js b/js/tests/unit/toast.js
index f2f8a756b..61830cfdb 100644
--- a/js/tests/unit/toast.js
+++ b/js/tests/unit/toast.js
@@ -146,11 +146,11 @@ $(function () {
.bootstrapToast()
.appendTo($('#qunit-fixture'))
- assert.ok(typeof $toast.data('bs.toast') !== 'undefined')
+ assert.notStrictEqual(typeof $toast.data('bs.toast'), 'undefined')
$toast.bootstrapToast('dispose')
- assert.ok(typeof $toast.data('bs.toast') === 'undefined')
+ assert.strictEqual(typeof $toast.data('bs.toast'), 'undefined')
})
QUnit.test('should allow to destroy toast and hide it before that', function (assert) {
@@ -171,12 +171,12 @@ $(function () {
$toast.one('shown.bs.toast', function () {
setTimeout(function () {
assert.ok($toast.hasClass('show'))
- assert.ok(typeof $toast.data('bs.toast') !== 'undefined')
+ assert.notStrictEqual(typeof $toast.data('bs.toast'), 'undefined')
$toast.bootstrapToast('dispose')
- assert.ok(typeof $toast.data('bs.toast') === 'undefined')
- assert.ok($toast.hasClass('show') === false)
+ assert.strictEqual(typeof $toast.data('bs.toast'), 'undefined')
+ assert.strictEqual($toast.hasClass('show'), false)
done()
}, 1)
@@ -312,7 +312,7 @@ $(function () {
toast._config.autohide = false
$toast.on('shown.bs.toast', function () {
assert.ok(spyClearTimeout.called)
- assert.ok(toast._timeout === null)
+ assert.strictEqual(toast._timeout, null)
done()
})
$toast.bootstrapToast('show')
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index 3c2423921..3d795b02c 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -89,7 +89,7 @@ $(function () {
$trigger.bootstrapTooltip('hide')
})
.one('hidden.bs.tooltip', function () {
- assert.ok(!$trigger[0].hasAttribute('aria-describedby'), 'trigger does not have aria-describedby')
+ assert.equal($trigger[0].hasAttribute('aria-describedby'), false, 'trigger does not have aria-describedby')
done()
})
.bootstrapTooltip('show')
@@ -165,7 +165,7 @@ $(function () {
.one('shown.bs.tooltip', function () {
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')
+ assert.equal($.contains($('.tooltip').get(0), title), false, 'title node copied, not moved')
done()
})
.bootstrapTooltip('show')
@@ -345,8 +345,8 @@ $(function () {
$tooltip.bootstrapTooltip('show')
$tooltip.bootstrapTooltip('dispose')
- assert.ok(!$tooltip.hasClass('show'), 'tooltip is hidden')
- assert.ok(!$._data($tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
+ assert.equal($tooltip.hasClass('show'), false, 'tooltip is hidden')
+ assert.equal($._data($tooltip[0], 'bs.tooltip'), false, 'tooltip does not have data')
assert.strictEqual($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip still has click.foo')
assert.ok(!$._data($tooltip[0], 'events').mouseover && !$._data($tooltip[0], 'events').mouseout, 'tooltip does not have hover events')
})
@@ -479,7 +479,7 @@ $(function () {
.on('inserted.bs.tooltip', function () {
var $tooltip = $($(this).data('bs.tooltip').tip)
assert.ok($tooltip.hasClass('bs-tooltip-right'))
- assert.ok(typeof $tooltip.attr('style') === 'undefined')
+ assert.strictEqual(typeof $tooltip.attr('style'), 'undefined')
$styles.remove()
done()
})
@@ -579,7 +579,7 @@ $(function () {
})
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip is not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '100ms: tooltip is not faded active')
}, 100)
setTimeout(function () {
@@ -601,12 +601,12 @@ $(function () {
})
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '100ms: tooltip not faded active')
$tooltip.trigger('mouseout')
}, 100)
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '200ms: tooltip not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '200ms: tooltip not faded active')
done()
}, 200)
@@ -655,12 +655,12 @@ $(function () {
})
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '100ms: tooltip not faded active')
$tooltip.trigger('mouseout')
}, 100)
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '200ms: tooltip not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '200ms: tooltip not faded active')
done()
}, 200)
@@ -681,12 +681,12 @@ $(function () {
})
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '100ms: tooltip not faded active')
$tooltip.trigger('mouseout')
}, 100)
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.show'), '250ms: tooltip not faded active')
+ assert.equal($('.tooltip').is('.fade.show'), false, '250ms: tooltip not faded active')
done()
}, 250)
@@ -716,7 +716,7 @@ $(function () {
}, 100)
setTimeout(function () {
- assert.ok(!$($tooltip.data('bs.tooltip').tip).is('.show'), '200ms: tooltip removed')
+ assert.equal($($tooltip.data('bs.tooltip').tip).is('.show'), false, '200ms: tooltip removed')
done()
}, 200)
}, 0)
@@ -785,10 +785,10 @@ $(function () {
$('#tt-outer').trigger('mouseleave')
assert.strictEqual(currentUid, $('#tt-content').text())
- assert.ok(obj._hoverState === 'out', 'the tooltip hoverState should be set to "out"')
+ assert.strictEqual(obj._hoverState, 'out', 'the tooltip hoverState should be set to "out"')
$('#tt-outer').trigger('mouseenter')
- assert.ok(obj._hoverState === 'show', 'the tooltip hoverState should be set to "show"')
+ assert.strictEqual(obj._hoverState, 'show', 'the tooltip hoverState should be set to "show"')
assert.strictEqual(currentUid, $('#tt-content').text())
})
@@ -838,7 +838,7 @@ $(function () {
['mouseenter', 'focusin', 'click', 'click', 'mouseleave', 'focusout']
]
- assert.ok(!showingTooltip())
+ assert.equal(showingTooltip(), false)
$.each(tests, function (idx, triggers) {
for (var i = 0, len = triggers.length; i < len; i++) {
@@ -868,7 +868,7 @@ $(function () {
assert.ok(showingTooltip(), 'tooltip is faded in')
$el.bootstrapTooltip('hide')
- assert.ok(!showingTooltip(), 'tooltip was faded out')
+ assert.equal(showingTooltip(), false, 'tooltip was faded out')
$el.trigger('click')
assert.ok(showingTooltip(), 'tooltip is faded in again')
@@ -1024,7 +1024,7 @@ $(function () {
var tooltip = $tooltip.data('bs.tooltip')
tooltip.update()
- assert.ok(tooltip._popper === null)
+ assert.strictEqual(tooltip._popper, null)
})
QUnit.test('should use Popper to get the tip on placement change', function (assert) {
@@ -1047,7 +1047,7 @@ $(function () {
placement: 'auto'
})
- assert.ok(tooltip.tip === $tipTest[0])
+ assert.strictEqual(tooltip.tip, $tipTest[0])
})
QUnit.test('should toggle enabled', function (assert) {
@@ -1086,8 +1086,8 @@ $(function () {
var tooltip = $trigger.data('bs.tooltip')
var offset = tooltip._getOffset()
- assert.ok(typeof offset.offset === 'undefined')
- assert.ok(typeof offset.fn === 'function')
+ assert.strictEqual(typeof offset.offset, 'undefined')
+ assert.strictEqual(typeof offset.fn, 'function')
})
QUnit.test('should create offset modifier correctly when offset option is not a function', function (assert) {
@@ -1104,7 +1104,7 @@ $(function () {
var offset = tooltip._getOffset()
assert.strictEqual(offset.offset, myOffset)
- assert.ok(typeof offset.fn === 'undefined')
+ assert.strictEqual(typeof offset.fn, 'undefined')
})
QUnit.test('should disable sanitizer', function (assert) {
@@ -1191,7 +1191,7 @@ $(function () {
var tooltip = $trigger.data('bs.tooltip')
assert.strictEqual(tooltip.config.template.indexOf(' ').appendTo($('#qunit-fixture'))
id2 = Util.getUID('test')
- assert.ok(id !== id2, id + ' !== ' + id2)
+ assert.notStrictEqual(id, id2, id + ' !== ' + id2)
})
QUnit.test('Util.supportsTransitionEnd should return true', function (assert) {
@@ -166,7 +166,7 @@ $(function () {
var $div = $('
').appendTo($('#qunit-fixture'))
if (!document.documentElement.attachShadow) {
- assert.strictEqual(null, Util.findShadowRoot($div[0]))
+ assert.strictEqual(Util.findShadowRoot($div[0]), null)
} else {
var sandbox = sinon.createSandbox()
@@ -175,7 +175,7 @@ $(function () {
return $div
})
- assert.strictEqual(null, Util.findShadowRoot($div[0]))
+ assert.strictEqual(Util.findShadowRoot($div[0]), null)
sandbox.restore()
}
})