X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Ffx.js;h=c20e39ceb83da807019ec58b4a5434b15899ad72;hb=e2ef3df86d5f54274bf2b779d882c30aa0886bfe;hp=1f9e674a163ea274a874d6d07539f549481809e5;hpb=6728e3cf74d02794113deb0af70a5f9a7caa2241;p=jquery.git diff --git a/test/unit/fx.js b/test/unit/fx.js index 1f9e674..c20e39c 100644 --- a/test/unit/fx.js +++ b/test/unit/fx.js @@ -11,6 +11,46 @@ test("animate(Hash, Object, Function)", function() { }); }); +test("animate option (queue === false)", function () { + expect(1); + stop(); + + var order = []; + + var $foo = $("#foo"); + $foo.animate({width:'100px'}, 200, function () { + // should finish after unqueued animation so second + order.push(2); + }); + $foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () { + // short duration and out of queue so should finish first + order.push(1); + }}); + $foo.animate({height:'100px'}, 10, function() { + // queued behind the first animation so should finish third + order.push(3); + isSet( order, [ 1, 2, 3], "Animations finished in the correct order" ); + start(); + }); +}); + +test("queue() defaults to 'fx' type", function () { + expect(2); + stop(); + + var $foo = $("#foo"); + $foo.queue("fx", [ "sample", "array" ]); + var arr = $foo.queue(); + isSet(arr, [ "sample", "array" ], "queue() got an array set with type 'fx'"); + $foo.queue([ "another", "one" ]); + var arr = $foo.queue("fx"); + isSet(arr, [ "another", "one" ], "queue('fx') got an array set with no type"); + // clean up after test + $foo.queue([]); + + start(); +}); + test("stop()", function() { expect(3); stop();