aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2012-08-13 12:43:49 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-08-19 21:48:52 -0400
commit3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf (patch)
tree1a329599ac875e3aa9fdad1d47c81b64f3e7248f /test
parent6b9fde13444cc54fefc1a235a42ec41571522252 (diff)
downloadjquery-3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf.tar.gz
jquery-3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf.zip
Fix #12278. Promises on non-default queue wait until a dequeue is attempted on an empty queue. Close gh-893.
Diffstat (limited to 'test')
-rw-r--r--test/unit/queue.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/unit/queue.js b/test/unit/queue.js
index 5c5317b42..5307bfd2b 100644
--- a/test/unit/queue.js
+++ b/test/unit/queue.js
@@ -1,6 +1,6 @@
module( "queue", { teardown: moduleTeardown });
-test( "queue() with other types", 12, function() {
+test( "queue() with other types", 14, function() {
var counter = 0;
stop();
@@ -45,6 +45,12 @@ test( "queue() with other types", 12, function() {
equal( counter, 4, "Testing previous call to dequeue" );
equal( $div.queue("foo").length, 0, "Testing queue length" );
+
+ $div.dequeue("foo");
+
+ equal( counter, 4, "Testing previous call to dequeue" );
+ equal( $div.queue("foo").length, 0, "Testing queue length" );
+
});
test("queue(name) passes in the next item in the queue as a parameter", function() {
@@ -206,8 +212,8 @@ asyncTest( "fn.promise( \"queue\" ) - called whenever last queue function is deq
}).queue( "queue", function( next ) {
strictEqual( test++, 2, "step two" );
setTimeout( function() {
- strictEqual( test++, 4, "step four" );
next();
+ strictEqual( test++, 4, "step four" );
start();
}, 10 );
}).promise( "queue" ).done( function() {
@@ -217,6 +223,27 @@ asyncTest( "fn.promise( \"queue\" ) - called whenever last queue function is deq
foo.dequeue( "queue" );
});
+asyncTest( "fn.promise( \"queue\" ) - waits for animation to complete before resolving", 2, function() {
+ var foo = jQuery( "#foo" ),
+ test = 1;
+
+ foo.animate({
+ top: 100
+ }, {
+ duration: 1,
+ queue: "queue",
+ complete: function() {
+ strictEqual( test++, 1, "step one" );
+ }
+ }).dequeue( "queue" );
+
+ foo.promise( "queue" ).done( function() {
+ strictEqual( test++, 2, "step two" );
+ start();
+ });
+
+});
+
test( ".promise(obj)", function() {
expect(2);