Skip to content
Permalink
Browse files

Animation callbacks keep their place in the queue stack. Fixes #9220.

  • Loading branch information...
timmywil
timmywil committed May 11, 2011
1 parent 0f81cf8 commit 3486365062cdc7e8598cea238e67aafa33af7dce
Showing with 28 additions and 4 deletions.
  1. +4 −4 src/effects.js
  2. +24 −0 test/unit/queue.js
@@ -330,15 +330,15 @@ jQuery.extend({
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}

if ( opt.queue !== false ) {
jQuery.dequeue( this );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}

if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
};

return opt;
@@ -107,7 +107,31 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
equals(counter, 2, "Deferreds resolved");
start();
});
});

test("callbacks keep their place in the queue", function() {
expect(5);
stop();
var div = jQuery("<div>"),
counter = 0;

div.queue(function( next ) {
equal( ++counter, 1, "Queue/callback order: first called" );
setTimeout( next, 200 );
}).show(100, function() {
equal( ++counter, 2, "Queue/callback order: second called" );
jQuery(this).hide(100, function() {
equal( ++counter, 4, "Queue/callback order: fourth called" );
});
}).queue(function( next ) {
equal( ++counter, 3, "Queue/callback order: third called" );
next();
});

div.promise("fx").done(function() {
equals(counter, 4, "Deferreds resolved");
start();
});
});

test("delay()", function() {

0 comments on commit 3486365

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