});\r
\r
test("queue() defaults to 'fx' type", function () {\r
- expect(2);\r
+ expect(1);\r
stop();\r
\r
+ var counter = 0;\r
+\r
var $foo = jQuery("#foo");\r
- $foo.queue("fx", [ "sample", "array" ]);\r
- var arr = $foo.queue();\r
- isSet(arr, [ "sample", "array" ], "queue() got an array set with type 'fx'");\r
- $foo.queue([ "another", "one" ]);\r
- var arr = $foo.queue("fx");\r
- isSet(arr, [ "another", "one" ], "queue('fx') got an array set with no type");\r
- // clean up after test\r
- $foo.queue([]);\r
\r
- start();\r
+ $foo.queue(function() {\r
+ var self = this;\r
+ setTimeout(function() {\r
+ jQuery(self).dequeue("fx");\r
+ start();\r
+ }, 200);\r
+ }).queue(function() {\r
+ ok( "dequeuing 'fx' calls queues created with no name" )\r
+ });\r
+\r
});\r
\r
test("queue() with other types",function() {\r
\r
equals( counter, 4, "Testing previous call to dequeue" );\r
equals( $div.queue('foo').length, 0, "Testing queue length" );\r
- \r
- // Clean up\r
- $div.removeData();\r
});\r
\r
test("queue(name) passes in the next item in the queue as a parameter", function() {\r
});\r
\r
div.dequeue("foo");\r
- \r
- div.removeData();\r
});\r
\r
test("queue(name) passes in the next item in the queue as a parameter", function() {\r
});\r
\r
div.dequeue("foo");\r
- \r
- div.removeData();\r
});\r
\r
test("queue() passes in the next item in the queue as a parameter to fx queues", function() {\r
expect(2);\r
+ stop();\r
\r
var div = jQuery({});\r
var counter = 0;\r
\r
div.queue(function(next) {\r
equals(++counter, 1, "Dequeueing");\r
- next();\r
+ var self = this;\r
+ setTimeout(function() { next() }, 500);\r
}).queue(function(next) {\r
equals(++counter, 2, "Next was called");\r
next();\r
+ start();\r
}).queue("bar", function() {\r
equals(++counter, 3, "Other queues are not triggered by next()")\r
});\r
- \r
- div.removeData();\r
+\r
});\r
\r
test("clearQueue(name) clears the queue", function() {\r
div.dequeue("foo");\r
\r
equals(counter, 1, "the queue was cleared");\r
- \r
- div.removeData();\r
});\r
\r
test("clearQueue() clears the fx queue", function() {\r
\r
div.queue(function(next) {\r
counter++;\r
- setTimeout(function() { jQuery(this).clearQueue(); next(); }, 50);\r
+ var self = this;\r
+ setTimeout(function() { jQuery(self).clearQueue(); next(); }, 50);\r
}).queue(function(next) {\r
counter++;\r
});\r