aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Methvin <[email protected]>2016-06-27 21:41:00 -0400
committerChris Rebert <[email protected]>2016-06-27 22:37:31 -0700
commit208d587c7ec0ea93c0d03c15d98952c8470af189 (patch)
treee9c6ef47616637515bb246e5f2a4f0cb78fee4d5
parente95e9fed09a4ef19d093ad8c44611da396c61d01 (diff)
downloadbootstrap-208d587c7ec0ea93c0d03c15d98952c8470af189.tar.xz
bootstrap-208d587c7ec0ea93c0d03c15d98952c8470af189.zip
Scrollspy test: Allow for async .then() in jQuery 3; fixes #20182
Instead of doing a new assert.async(), just do a single one for the entire test and let the .then() be async as well. Closes #20190
-rw-r--r--js/tests/unit/scrollspy.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js
index b04a9d863..772fedc2e 100644
--- a/js/tests/unit/scrollspy.js
+++ b/js/tests/unit/scrollspy.js
@@ -314,21 +314,21 @@ $(function () {
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)
return deferred.promise()
}
+ var done = assert.async()
$.when(testElementIsActiveAfterScroll('#li-100-5', '#div-100-5'))
.then(function () { return testElementIsActiveAfterScroll('#li-100-4', '#div-100-4') })
.then(function () { return testElementIsActiveAfterScroll('#li-100-3', '#div-100-3') })
.then(function () { return testElementIsActiveAfterScroll('#li-100-2', '#div-100-2') })
.then(function () { return testElementIsActiveAfterScroll('#li-100-1', '#div-100-1') })
+ .then(function () { done() })
})
QUnit.test('should allow passed in option offset method: offset', function (assert) {