aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/queue.js
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2011-09-28 11:55:29 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-28 11:55:29 -0400
commita3b59d7f92c9e15af1888fc4e87639a290763a50 (patch)
treecc533a93c3c0a02fae95018b3447b94927e5ff2e /test/unit/queue.js
parenta74cbb2b911b3afad96599728208d95a60d24cbf (diff)
downloadjquery-a3b59d7f92c9e15af1888fc4e87639a290763a50.tar.gz
jquery-a3b59d7f92c9e15af1888fc4e87639a290763a50.zip
Landing pull request 514. 1.7 - queue refactoring to handle delay stop - Fixes #6150.
More Details: - https://github.com/jquery/jquery/pull/514 - http://bugs.jquery.com/ticket/6150
Diffstat (limited to 'test/unit/queue.js')
-rw-r--r--test/unit/queue.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/unit/queue.js b/test/unit/queue.js
index b5c058caa..95bbfc97e 100644
--- a/test/unit/queue.js
+++ b/test/unit/queue.js
@@ -130,6 +130,44 @@ test("delay()", function() {
equals( run, 0, "The delay delayed the next function from running." );
});
+test("delay() can be stopped", function() {
+ expect( 3 );
+ stop();
+
+ var foo = jQuery({}), run = 0;
+
+ foo
+ .queue( "alternate", function( next ) {
+ run++;
+ ok( true, "This first function was dequeued" );
+ next();
+ })
+ .delay( 100, "alternate" )
+ .queue( "alternate", function() {
+ run++;
+ ok( true, "The function was dequeued immediately, the delay was stopped" );
+ })
+ .dequeue( "alternate" )
+
+ // stop( false ) will NOT clear the queue, so it should automatically dequeue the next
+ .stop( false, false, "alternate" )
+
+ // this test
+ .delay( 100 )
+ .queue(function() {
+ run++;
+ ok( false, "This queue should never run" );
+ })
+
+ // stop( clearQueue ) should clear the queue
+ .stop( true, false );
+
+ equal( run, 2, "Queue ran the proper functions" );
+
+ setTimeout( start, 200 );
+});
+
+
test("clearQueue(name) clears the queue", function() {
expect(2);