2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-08 17:22:31 +03:00

JS unit tests: use modern QUnit assert object everywhere

This commit is contained in:
Chris Rebert
2015-02-23 21:55:07 -08:00
parent 1cbbeef47c
commit 7c19fee3f1
11 changed files with 504 additions and 504 deletions
+12 -12
View File
@@ -3,8 +3,8 @@ $(function () {
module('affix plugin')
test('should be defined on jquery object', function () {
ok($(document.body).affix, 'affix method is defined')
test('should be defined on jquery object', function (assert) {
assert.ok($(document.body).affix, 'affix method is defined')
})
module('affix', {
@@ -18,21 +18,21 @@ $(function () {
}
})
test('should provide no conflict', function () {
strictEqual($.fn.affix, undefined, 'affix was set back to undefined (org value)')
test('should provide no conflict', function (assert) {
assert.strictEqual($.fn.affix, undefined, 'affix was set back to undefined (org value)')
})
test('should return jquery collection containing the element', function () {
test('should return jquery collection containing the element', function (assert) {
var $el = $('<div/>')
var $affix = $el.bootstrapAffix()
ok($affix instanceof $, 'returns jquery collection')
strictEqual($affix[0], $el[0], 'collection contains element')
assert.ok($affix instanceof $, 'returns jquery collection')
assert.strictEqual($affix[0], $el[0], 'collection contains element')
})
test('should exit early if element is not visible', function () {
test('should exit early if element is not visible', function (assert) {
var $affix = $('<div style="display: none"/>').bootstrapAffix()
$affix.data('bs.affix').checkPosition()
ok(!$affix.hasClass('affix'), 'affix class was not added')
assert.ok(!$affix.hasClass('affix'), 'affix class was not added')
})
test('should trigger affixed event after affix', function (assert) {
@@ -53,9 +53,9 @@ $(function () {
$('#affixTarget')
.on('affix.bs.affix', function () {
ok(true, 'affix event fired')
assert.ok(true, 'affix event fired')
}).on('affixed.bs.affix', function () {
ok(true, 'affixed event fired')
assert.ok(true, 'affixed event fired')
$('#affixTarget, #affixAfter').remove()
done()
})
@@ -85,7 +85,7 @@ $(function () {
offset: { top: 120, bottom: 0 }
})
.on('affixed-top.bs.affix', function () {
ok($('#affixTopTarget').hasClass('affix-top'), 'affix-top class applied')
assert.ok($('#affixTopTarget').hasClass('affix-top'), 'affix-top class applied')
$('#padding-offset').remove()
done()
})