diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2016-06-28 23:24:28 +0300 |
---|---|---|
committer | Chris Rebert <github@chrisrebert.com> | 2016-06-28 23:24:28 +0300 |
commit | 8900d953ed8b7d2416c2c31667790d83853a0a06 (patch) | |
tree | ef82b2a39cc2e18f39e636450af65bb6c98ba833 /js | |
parent | c3e33d85d733b83887b203b7fd85c49ff8e5ff28 (diff) |
ScrollSpy unit test: Use single done() in a then() instead of multiple done()s (#20198)
Fixes test flakiness on OS X Safari and Android when using jQuery 3.
Fixes #20182 more
Refs #20191
Diffstat (limited to 'js')
-rw-r--r-- | js/tests/unit/scrollspy.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 772fedc2ec..97ddd16ece 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -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) @@ -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) { |