diff options
Diffstat (limited to 'js/tests/unit/scrollspy.js')
| -rw-r--r-- | js/tests/unit/scrollspy.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 0c9081491..028da4bd9 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -29,8 +29,8 @@ $(function () { strictEqual($scrollspy[0], $el[0], 'collection contains element') }) - test('should only switch "active" class on current target', function () { - stop() + test('should only switch "active" class on current target', function (assert) { + var done = assert.async() var sectionHTML = '<div id="root" class="active">' + '<div class="topbar">' @@ -67,14 +67,14 @@ $(function () { $scrollspy.on('scroll.bs.scrollspy', function () { ok($section.hasClass('active'), '"active" class still on root node') - start() + done() }) $scrollspy.scrollTop(350) }) - test('should correctly select middle navigation option when large offset is used', function () { - stop() + test('should correctly select middle navigation option when large offset is used', function (assert) { + var done = assert.async() var sectionHTML = '<div id="header" style="height: 500px;"></div>' + '<nav id="navigation" class="navbar">' @@ -100,13 +100,13 @@ $(function () { ok(!$section.find('#one-link').parent().hasClass('active'), '"active" class removed from first section') ok($section.find('#two-link').parent().hasClass('active'), '"active" class on middle section') ok(!$section.find('#three-link').parent().hasClass('active'), '"active" class not on last section') - start() + done() }) $scrollspy.scrollTop(550) }) - test('should add the active class to the correct element', function () { + test('should add the active class to the correct element', function (assert) { var navbarHtml = '<nav class="navbar">' + '<ul class="nav">' @@ -128,10 +128,10 @@ $(function () { var testElementIsActiveAfterScroll = function (element, target) { var deferred = $.Deferred() var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) - stop() + var done = assert.async() $content.one('scroll', function () { ok($(element).hasClass('active'), 'target:' + target + ', element' + element) - start() + done() deferred.resolve() }) $content.scrollTop(scrollHeight) @@ -142,8 +142,8 @@ $(function () { .then(function () { return testElementIsActiveAfterScroll('#li-2', '#div-2') }) }) - test('should clear selection if above the first section', function () { - stop() + test('should clear selection if above the first section', function (assert) { + var done = assert.async() var sectionHTML = '<div id="header" style="height: 500px;"></div>' + '<nav id="navigation" class="navbar">' @@ -176,7 +176,7 @@ $(function () { $scrollspy .one('scroll.bs.scrollspy', function () { strictEqual($('.active').length, 0, 'selection cleared') - start() + done() }) .scrollTop(0) }) |
