Skip to content

Commit 81432c8

Browse files
committed
Trying to repair a unit
1 parent 0f14c53 commit 81432c8

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

test/unit/effects.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,25 +1405,29 @@ asyncTest( "jQuery.Animation( object, props, opts )", 4, function() {
14051405

14061406
asyncTest( "Animate Option: step: function( percent, tween )", 1, function() {
14071407
var counter = {};
1408-
jQuery( "#foo" ).animate({
1409-
prop1: 1,
1410-
prop2: 2,
1411-
prop3: 3
1412-
}, {
1413-
duration: 1,
1414-
step: function( value, tween ) {
1415-
var calls = counter[ tween.prop ] = counter[ tween.prop ] || [];
1416-
calls.push( value );
1417-
}
1418-
}).queue( function( next ) {
1419-
deepEqual( counter, {
1420-
prop1: [0, 1],
1421-
prop2: [0, 2],
1422-
prop3: [0, 3]
1423-
}, "Step function was called once at 0% and once at 100% for each property");
1424-
next();
1425-
start();
1426-
});
1408+
// if the animation loop is already running when we start this test, it WILL fail
1409+
// going to try delaying 100ms to make sure any potential leftover animations are done
1410+
setTimeout( function() {
1411+
jQuery( "#foo" ).animate({
1412+
prop1: 1,
1413+
prop2: 2,
1414+
prop3: 3
1415+
}, {
1416+
duration: 1,
1417+
step: function( value, tween ) {
1418+
var calls = counter[ tween.prop ] = counter[ tween.prop ] || [];
1419+
calls.push( value );
1420+
}
1421+
}).queue( function( next ) {
1422+
deepEqual( counter, {
1423+
prop1: [0, 1],
1424+
prop2: [0, 2],
1425+
prop3: [0, 3]
1426+
}, "Step function was called once at 0% and once at 100% for each property");
1427+
next();
1428+
start();
1429+
});
1430+
}, 100 );
14271431
});
14281432

14291433
asyncTest( "Animate callbacks have correct context", 2, function() {

0 commit comments

Comments
 (0)