diff options
author | Corey Frang <gnarf@gnarf.net> | 2012-07-25 15:18:01 -0500 |
---|---|---|
committer | Corey Frang <gnarf@gnarf.net> | 2012-07-25 15:18:25 -0500 |
commit | 81432c883576ebccdc164704847a7b38c8513bcc (patch) | |
tree | 8666837951ab374882bbc674ba308edc511f45af /test/unit/effects.js | |
parent | 0f14c53d7217ad65c5dfbb043c96f2683a563540 (diff) | |
download | jquery-81432c883576ebccdc164704847a7b38c8513bcc.tar.gz jquery-81432c883576ebccdc164704847a7b38c8513bcc.zip |
Trying to repair a unit
Diffstat (limited to 'test/unit/effects.js')
-rw-r--r-- | test/unit/effects.js | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js index 17ba1c21a..a35505884 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1405,25 +1405,29 @@ asyncTest( "jQuery.Animation( object, props, opts )", 4, function() { asyncTest( "Animate Option: step: function( percent, tween )", 1, function() { var counter = {}; - jQuery( "#foo" ).animate({ - prop1: 1, - prop2: 2, - prop3: 3 - }, { - duration: 1, - step: function( value, tween ) { - var calls = counter[ tween.prop ] = counter[ tween.prop ] || []; - calls.push( value ); - } - }).queue( function( next ) { - deepEqual( counter, { - prop1: [0, 1], - prop2: [0, 2], - prop3: [0, 3] - }, "Step function was called once at 0% and once at 100% for each property"); - next(); - start(); - }); + // if the animation loop is already running when we start this test, it WILL fail + // going to try delaying 100ms to make sure any potential leftover animations are done + setTimeout( function() { + jQuery( "#foo" ).animate({ + prop1: 1, + prop2: 2, + prop3: 3 + }, { + duration: 1, + step: function( value, tween ) { + var calls = counter[ tween.prop ] = counter[ tween.prop ] || []; + calls.push( value ); + } + }).queue( function( next ) { + deepEqual( counter, { + prop1: [0, 1], + prop2: [0, 2], + prop3: [0, 3] + }, "Step function was called once at 0% and once at 100% for each property"); + next(); + start(); + }); + }, 100 ); }); asyncTest( "Animate callbacks have correct context", 2, function() { |