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

[Fixes #15953] Implement assert.expect in each unit test

[Fixes #15953] Implement `assert.expect` in each unit test
This commit is contained in:
Kevin Kirsche
2015-03-01 09:33:48 -05:00
parent 4311e09b04
commit 4febcb4b49
12 changed files with 198 additions and 4 deletions
+6
View File
@@ -4,6 +4,7 @@ $(function () {
QUnit.module('affix plugin')
QUnit.test('should be defined on jquery object', function (assert) {
assert.expect(1)
assert.ok($(document.body).affix, 'affix method is defined')
})
@@ -19,10 +20,12 @@ $(function () {
})
QUnit.test('should provide no conflict', function (assert) {
assert.expect(1)
assert.strictEqual($.fn.affix, undefined, 'affix was set back to undefined (org value)')
})
QUnit.test('should return jquery collection containing the element', function (assert) {
assert.expect(2)
var $el = $('<div/>')
var $affix = $el.bootstrapAffix()
assert.ok($affix instanceof $, 'returns jquery collection')
@@ -30,12 +33,14 @@ $(function () {
})
QUnit.test('should exit early if element is not visible', function (assert) {
assert.expect(1)
var $affix = $('<div style="display: none"/>').bootstrapAffix()
$affix.data('bs.affix').checkPosition()
assert.ok(!$affix.hasClass('affix'), 'affix class was not added')
})
QUnit.test('should trigger affixed event after affix', function (assert) {
assert.expect(2)
var done = assert.async()
var templateHTML = '<div id="affixTarget">'
@@ -70,6 +75,7 @@ $(function () {
})
QUnit.test('should affix-top when scrolling up to offset when parent has padding', function (assert) {
assert.expect(1)
var done = assert.async()
var templateHTML = '<div id="padding-offset" style="padding-top: 20px;">'