Skip to content

Commit

Permalink
Fix second scrollspy unit tests for async .then() in jQuery 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmethvin committed Jun 28, 2016
1 parent a21ff40 commit 76fc2be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/tests/unit/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,12 @@ $(function () {
.appendTo('#qunit-fixture')
.bootstrapScrollspy({ offset: 0, target: '.navbar' })

var done = assert.async()
var testElementIsActiveAfterScroll = function (element, target) {
var deferred = $.Deferred()
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top)
var done = assert.async()
$content.one('scroll', function () {
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
done()
deferred.resolve()
})
$content.scrollTop(scrollHeight)
Expand All @@ -203,6 +202,7 @@ $(function () {

$.when(testElementIsActiveAfterScroll('#a-1', '#div-1'))
.then(function () { return testElementIsActiveAfterScroll('#a-2', '#div-2') })
.then(function () { done() })
})

QUnit.test('should add the active class correctly when there are nested elements at 0 scroll offset', function (assert) {
Expand Down

0 comments on commit 76fc2be

Please sign in to comment.