From 1d299d375b6d97d65559286d914df2d5a77949db Mon Sep 17 00:00:00 2001 From: David Serduke Date: Fri, 16 Nov 2007 17:49:12 +0000 Subject: [PATCH] Fix for #1823 bug in animate {queue:false} plus a unit test. --- src/fx.js | 3 ++- test/unit/fx.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/fx.js b/src/fx.js index a4f4ef8..4ccb089 100644 --- a/src/fx.js +++ b/src/fx.js @@ -201,7 +201,8 @@ jQuery.extend({ // Queueing opt.old = opt.complete; opt.complete = function(){ - jQuery(this).dequeue(); + if ( opt.queue !== false ) + jQuery(this).dequeue(); if ( jQuery.isFunction( opt.old ) ) opt.old.apply( this ); }; diff --git a/test/unit/fx.js b/test/unit/fx.js index 1f9e674..6c5bb55 100644 --- a/test/unit/fx.js +++ b/test/unit/fx.js @@ -11,6 +11,29 @@ 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] ); + start(); + }); +}); + test("stop()", function() { expect(3); stop(); -- 1.7.10.4