mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-08 17:22:31 +03:00
tests: comply to the new rules
Use `assert.strictEqual`/`assert.true`/`assert.false`
This commit is contained in:
+28
-28
@@ -40,7 +40,7 @@ $(function () {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>').appendTo('#qunit-fixture')
|
||||
var $scrollspy = $el.bootstrapScrollspy()
|
||||
assert.ok($scrollspy instanceof $, 'returns jquery collection')
|
||||
assert.true($scrollspy instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($scrollspy[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
@@ -84,7 +84,7 @@ $(function () {
|
||||
})
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
assert.ok($section.hasClass('active'), '"active" class still on root node')
|
||||
assert.true($section.hasClass('active'), '"active" class still on root node')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -131,7 +131,7 @@ $(function () {
|
||||
})
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
assert.ok($section.hasClass('active'), '"active" class still on root node')
|
||||
assert.true($section.hasClass('active'), '"active" class still on root node')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -179,7 +179,7 @@ $(function () {
|
||||
})
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
assert.ok($section.hasClass('active'), '"active" class still on root node')
|
||||
assert.true($section.hasClass('active'), '"active" class still on root node')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -226,10 +226,10 @@ $(function () {
|
||||
target: $('.container')
|
||||
})
|
||||
|
||||
assert.ok($('.container').attr('id').length > 0, '`target` has an ID attribute')
|
||||
assert.notStrictEqual($('.container').attr('id').length, 0, '`target` has an ID attribute')
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
assert.ok($section.hasClass('active'), '"active" class still on root node')
|
||||
assert.true($section.hasClass('active'), '"active" class still on root node')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -264,9 +264,9 @@ $(function () {
|
||||
})
|
||||
|
||||
$scrollspy.one('scroll', function () {
|
||||
assert.ok(!$section.find('#one-link').hasClass('active'), '"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.false($section.find('#one-link').hasClass('active'), '"active" class removed from first section')
|
||||
assert.true($section.find('#two-link').hasClass('active'), '"active" class on middle section')
|
||||
assert.false($section.find('#three-link').hasClass('active'), '"active" class not on last section')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -303,7 +303,7 @@ $(function () {
|
||||
var paddingTop = 5
|
||||
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
assert.true($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
deferred.resolve()
|
||||
})
|
||||
$content.scrollTop(scrollHeight)
|
||||
@@ -349,7 +349,7 @@ $(function () {
|
||||
var paddingTop = 5
|
||||
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
assert.true($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
deferred.resolve()
|
||||
})
|
||||
$content.scrollTop(scrollHeight)
|
||||
@@ -395,7 +395,7 @@ $(function () {
|
||||
var paddingTop = 5
|
||||
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
assert.true($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
deferred.resolve()
|
||||
})
|
||||
$content.scrollTop(scrollHeight)
|
||||
@@ -446,8 +446,8 @@ $(function () {
|
||||
}
|
||||
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.ok($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
assert.true($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.true($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
testActiveElements()
|
||||
})
|
||||
|
||||
@@ -491,8 +491,8 @@ $(function () {
|
||||
}
|
||||
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.ok($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
assert.true($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.true($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
testActiveElements()
|
||||
})
|
||||
|
||||
@@ -536,8 +536,8 @@ $(function () {
|
||||
}
|
||||
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.ok($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
assert.true($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.true($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
testActiveElements()
|
||||
})
|
||||
|
||||
@@ -581,8 +581,8 @@ $(function () {
|
||||
}
|
||||
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.ok($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
assert.true($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
|
||||
assert.true($('#a-2').hasClass('active'), 'nav item for inner element has "active" class')
|
||||
testActiveElements()
|
||||
})
|
||||
|
||||
@@ -622,7 +622,7 @@ $(function () {
|
||||
})
|
||||
.one('scroll', function () {
|
||||
assert.strictEqual($('.active').length, 1, '"active" class on only one element present')
|
||||
assert.strictEqual($('.active').is('#two-link'), true, '"active" class on second section')
|
||||
assert.true($('.active').is('#two-link'), '"active" class on second section')
|
||||
$scrollspy
|
||||
.one('scroll', function () {
|
||||
assert.strictEqual($('.active').length, 0, 'selection cleared')
|
||||
@@ -665,11 +665,11 @@ $(function () {
|
||||
})
|
||||
.one('scroll', function () {
|
||||
assert.strictEqual($('.active').length, 1, '"active" class on only one element present')
|
||||
assert.strictEqual($('.active').is('#two-link'), true, '"active" class on second section')
|
||||
assert.true($('.active').is('#two-link'), '"active" class on second section')
|
||||
$scrollspy
|
||||
.one('scroll', function () {
|
||||
assert.strictEqual($('.active').length, 1, '"active" class on only one element present')
|
||||
assert.strictEqual($('.active').is('#one-link'), true, '"active" class on first section')
|
||||
assert.true($('.active').is('#one-link'), '"active" class on first section')
|
||||
done()
|
||||
})
|
||||
.scrollTop(negativeHeight)
|
||||
@@ -712,7 +712,7 @@ $(function () {
|
||||
var paddingTop = 5
|
||||
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
|
||||
$content.one('scroll', function () {
|
||||
assert.ok($(element).hasClass('active'), 'target:' + target + ', element: ' + element)
|
||||
assert.true($(element).hasClass('active'), 'target:' + target + ', element: ' + element)
|
||||
deferred.resolve()
|
||||
})
|
||||
$content.scrollTop(scrollHeight)
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user