aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2011-09-19 16:08:00 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-19 16:08:00 -0400
commite4c48a34b4fe687d4a3b935b6c405f502dd0223e (patch)
tree9536f442611b7e16a087e5f92cc0f0619b701e13 /test
parentaf1dc64bee90960f7898699c3788133177aff3bc (diff)
downloadjquery-e4c48a34b4fe687d4a3b935b6c405f502dd0223e.tar.gz
jquery-e4c48a34b4fe687d4a3b935b6c405f502dd0223e.zip
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
Diffstat (limited to 'test')
-rw-r--r--test/unit/effects.js35
1 files changed, 35 insertions, 0 deletions
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);