Skip to content
Permalink
Browse files

Added a next() shortcut for queues

  • Loading branch information
wycats committed Jul 12, 2009
1 parent 5b84c7c commit 89b4bc53ca0ca3d4e5c80b94ce92b09cc34af8ef
Showing with 22 additions and 1 deletion.
  1. +1 −1 src/data.js
  2. +21 −0 test/unit/data.js
@@ -92,7 +92,7 @@ jQuery.extend({
fn = queue[0];

if( fn !== undefined )
fn.call(elem);
fn.call(elem, function() { jQuery(elem).dequeue(type); });
}
});

@@ -157,4 +157,25 @@ test("queue() with other types",function() {

// Clean up
$div.removeData();
});

test("queue() passes in the next item in the queue as a parameter", function() {
expect(2);

var div = jQuery({});
var counter = 0;

div.queue("foo", function(next) {
equals(++counter, 1, "Dequeueing");
next();
}).queue("foo", function(next) {
equals(++counter, 2, "Next was called");
next();
}).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()")
});

div.dequeue("foo");

div.removeData();
})

0 comments on commit 89b4bc5

Please sign in to comment.
You can’t perform that action at this time.