From e4c48a34b4fe687d4a3b935b6c405f502dd0223e Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Mon, 19 Sep 2011 16:08:00 -0400 Subject: Landing pull request 496. 1.7 animate: allow named queues to be used by animate. Fixes #9280. More Details: - https://github.com/jquery/jquery/pull/496 - http://bugs.jquery.com/ticket/9280 --- test/unit/effects.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test') diff --git a/test/unit/effects.js b/test/unit/effects.js index 74d4c7642..d13bd587c 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -357,6 +357,41 @@ test("animate option (queue === false)", function () { }); */ +asyncTest( "animate option { queue: 'name' }", function() { + expect( 5 ); + + var foo = jQuery( "#foo" ), + origWidth = foo.width(), + order = []; + + foo.animate( { width: origWidth + 100 }, { + queue: 'name', + duration: 1, + complete: function() { + + // second callback function + order.push( 2 ); + equals( foo.width(), origWidth + 100, "Animation ended" ); + equals( foo.queue("name").length, 1, "Queue length of 'name' queue" ); + } + }).queue( "name", function( next ) { + + // last callback function + deepEqual( order, [ 1, 2 ], "Callbacks in expected order" ); + start(); + }); + + setTimeout( function() { + + // this is the first callback function that should be called + order.push( 1 ); + equals( foo.width(), origWidth, "Animation does not start on its own." ); + equals( foo.queue("name").length, 2, "Queue length of 'name' queue" ); + foo.dequeue( "name" ); + }, 100 ); + +}); + test("animate with no properties", function() { expect(2); -- cgit v1.2.3