diff options
Diffstat (limited to 'test/unit/effects.js')
-rw-r--r-- | test/unit/effects.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js index fed25eeb0..a2645b106 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1628,3 +1628,84 @@ asyncTest( "hide, fadeOut and slideUp called on element width height and width = start(); }); }); + +asyncTest( "Handle queue:false promises", 10, function() { + var foo = jQuery( "#foo" ).clone().andSelf(), + step = 1; + + foo.animate({ + top: 1 + }, { + duration: 10, + queue: false, + complete: function() { + ok( step++ <= 2, "Step one or two" ); + } + }).animate({ + bottom: 1 + }, { + duration: 10, + complete: function() { + ok( step > 2 && step < 5, "Step three or four" ); + step++; + } + }); + + foo.promise().done( function() { + equal( step++, 5, "steps 1-5: queue:false then queue:fx done" ); + foo.animate({ + top: 10 + }, { + duration: 10, + complete: function() { + ok( step > 5 && step < 8, "Step six or seven" ); + step++; + } + }).animate({ + bottom: 10 + }, { + duration: 10, + queue: false, + complete: function() { + ok( step > 7 && step < 10, "Step eight or nine" ); + step++; + } + }).promise().done( function() { + equal( step++, 10, "steps 6-10: queue:fx then queue:false" ); + start(); + }); + + }); +}); + +asyncTest( "multiple unqueued and promise", 4, function() { + var foo = jQuery( "#foo" ), + step = 1; + foo.animate({ + marginLeft: 300 + }, { + duration: 500, + queue: false, + complete: function() { + strictEqual( step++, 2, "Step 2" ); + } + }).animate({ + top: 100 + }, { + duration: 1500, + queue: false, + complete: function() { + strictEqual( step++, 3, "Step 3" ); + } + }).animate({}, { + duration: 2000, + queue: false, + complete: function() { + // no properties is a non-op and finishes immediately + strictEqual( step++, 1, "Step 1" ); + } + }).promise().done( function() { + strictEqual( step++, 4, "Step 4" ); + start(); + }); +});
\ No newline at end of file |