2015-08-16 06:59:58 +00:00
|
|
|
QUnit.module( "queue", { teardown: moduleTeardown } );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "queue() with other types", function( assert ) {
|
|
|
|
assert.expect( 14 );
|
2015-07-29 15:10:04 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.stop();
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var $div = jQuery( {} ),
|
2013-04-09 15:45:09 +00:00
|
|
|
counter = 0;
|
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
$div.promise( "foo" ).done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( counter, 0, "Deferred for collection with no queue is automatically resolved" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-06 22:19:33 +00:00
|
|
|
$div
|
2015-08-16 06:59:58 +00:00
|
|
|
.queue( "foo", function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 1, "Dequeuing" );
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery.dequeue( this, "foo" );
|
|
|
|
} )
|
|
|
|
.queue( "foo", function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 2, "Dequeuing" );
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery( this ).dequeue( "foo" );
|
|
|
|
} )
|
|
|
|
.queue( "foo", function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 3, "Dequeuing" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} )
|
|
|
|
.queue( "foo", function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 4, "Dequeuing" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
$div.promise( "foo" ).done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( counter, 4, "Testing previous call to dequeue in deferred" );
|
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( $div.queue( "foo" ).length, 4, "Testing queue length" );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( $div.queue( "foo", undefined ).queue( "foo" ).length, 4, ".queue('name',undefined) does nothing but is chainable (#5571)" );
|
2011-12-06 20:25:38 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
$div.dequeue( "foo" );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( counter, 3, "Testing previous call to dequeue" );
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( $div.queue( "foo" ).length, 1, "Testing queue length" );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
$div.dequeue( "foo" );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( counter, 4, "Testing previous call to dequeue" );
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( $div.queue( "foo" ).length, 0, "Testing queue length" );
|
2012-08-13 17:43:49 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
$div.dequeue( "foo" );
|
2012-08-13 17:43:49 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( counter, 4, "Testing previous call to dequeue" );
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( $div.queue( "foo" ).length, 0, "Testing queue length" );
|
2012-08-13 17:43:49 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "queue(name) passes in the next item in the queue as a parameter", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var div = jQuery( {} ),
|
2013-04-09 15:45:09 +00:00
|
|
|
counter = 0;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.queue( "foo", function( next ) {
|
|
|
|
assert.equal( ++counter, 1, "Dequeueing" );
|
2009-12-06 22:19:33 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).queue( "foo", function( next ) {
|
|
|
|
assert.equal( ++counter, 2, "Next was called" );
|
2009-12-06 22:19:33 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).queue( "bar", function() {
|
|
|
|
assert.equal( ++counter, 3, "Other queues are not triggered by next()" );
|
|
|
|
} );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.dequeue( "foo" );
|
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "queue() passes in the next item in the queue as a parameter to fx queues", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.stop();
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var div = jQuery( {} ),
|
2013-04-09 15:45:09 +00:00
|
|
|
counter = 0;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.queue( function( next ) {
|
|
|
|
assert.equal( ++counter, 1, "Dequeueing" );
|
|
|
|
setTimeout( function() { next(); }, 500 );
|
|
|
|
} ).queue( function( next ) {
|
|
|
|
assert.equal( ++counter, 2, "Next was called" );
|
2009-12-06 22:19:33 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).queue( "bar", function() {
|
|
|
|
assert.equal( ++counter, 3, "Other queues are not triggered by next()" );
|
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery.when( div.promise( "fx" ), div ).done( function() {
|
|
|
|
assert.equal( counter, 2, "Deferreds resolved" );
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-05-11 18:31:42 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "callbacks keep their place in the queue", function( assert ) {
|
|
|
|
assert.expect( 5 );
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.stop();
|
2015-08-16 06:59:58 +00:00
|
|
|
var div = jQuery( "<div>" ),
|
2011-05-11 18:31:42 +00:00
|
|
|
counter = 0;
|
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.queue( function( next ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 1, "Queue/callback order: first called" );
|
2011-05-11 18:31:42 +00:00
|
|
|
setTimeout( next, 200 );
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).delay( 100 ).queue( function( next ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 2, "Queue/callback order: second called" );
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery( this ).delay( 100 ).queue( function( next ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 4, "Queue/callback order: fourth called" );
|
2012-05-29 02:25:04 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-29 02:25:04 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).queue( function( next ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ++counter, 3, "Queue/callback order: third called" );
|
2011-05-11 18:31:42 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.promise( "fx" ).done( function() {
|
|
|
|
assert.equal( counter, 4, "Deferreds resolved" );
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "jQuery.queue should return array while manipulating the queue", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2015-07-29 15:10:04 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var div = document.createElement( "div" );
|
2013-04-08 19:36:24 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( jQuery.isArray( jQuery.queue( div, "fx", jQuery.noop ) ), "jQuery.queue should return an array while manipulating the queue" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2013-04-08 19:36:24 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "delay()", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.stop();
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var foo = jQuery( {} ), run = 0;
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
foo.delay( 100 ).queue( function() {
|
2009-12-06 22:19:33 +00:00
|
|
|
run = 1;
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( true, "The function was dequeued." );
|
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( run, 0, "The delay delayed the next function from running." );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "clearQueue(name) clears the queue", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.stop();
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var div = jQuery( {} ),
|
2013-04-09 15:45:09 +00:00
|
|
|
counter = 0;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.queue( "foo", function( next ) {
|
2009-12-06 22:19:33 +00:00
|
|
|
counter++;
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery( this ).clearQueue( "foo" );
|
2009-12-06 22:19:33 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).queue( "foo", function() {
|
2009-12-06 22:19:33 +00:00
|
|
|
counter++;
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.promise( "foo" ).done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( true, "dequeue resolves the deferred" );
|
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.dequeue( "foo" );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( counter, 1, "the queue was cleared" );
|
|
|
|
} );
|
2009-12-06 22:19:33 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "clearQueue() clears the fx queue", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
var div = jQuery( {} ),
|
2013-04-09 15:45:09 +00:00
|
|
|
counter = 0;
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
div.queue( function( next ) {
|
2009-12-06 22:19:33 +00:00
|
|
|
counter++;
|
|
|
|
var self = this;
|
2015-08-16 06:59:58 +00:00
|
|
|
setTimeout( function() { jQuery( self ).clearQueue(); next(); }, 50 );
|
|
|
|
} ).queue( function() {
|
2009-12-06 22:19:33 +00:00
|
|
|
counter++;
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.equal( counter, 1, "the queue was cleared" );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2009-12-06 22:19:33 +00:00
|
|
|
div.removeData();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.asyncTest( "fn.promise() - called when fx queue is empty", 3, function( assert ) {
|
2013-02-27 03:55:36 +00:00
|
|
|
var foo = jQuery( "#foo" ).clone().addBack(),
|
2012-05-23 03:04:45 +00:00
|
|
|
promised = false;
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2012-05-23 03:04:45 +00:00
|
|
|
foo.queue( function( next ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2012-05-23 03:04:45 +00:00
|
|
|
// called twice!
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( !promised, "Promised hasn't been called" );
|
2012-05-23 03:04:45 +00:00
|
|
|
setTimeout( next, 10 );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-23 03:04:45 +00:00
|
|
|
foo.promise().done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( promised = true, "Promised" );
|
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.asyncTest( "fn.promise( \"queue\" ) - called whenever last queue function is dequeued", 5, function( assert ) {
|
2012-05-23 03:04:45 +00:00
|
|
|
var foo = jQuery( "#foo" ),
|
|
|
|
test;
|
|
|
|
foo.promise( "queue" ).done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test, undefined, "called immediately when queue was already empty" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-23 03:04:45 +00:00
|
|
|
test = 1;
|
|
|
|
foo.queue( "queue", function( next ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test++, 1, "step one" );
|
2012-05-23 03:04:45 +00:00
|
|
|
setTimeout( next, 0 );
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).queue( "queue", function( next ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test++, 2, "step two" );
|
2012-05-23 03:04:45 +00:00
|
|
|
setTimeout( function() {
|
|
|
|
next();
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test++, 4, "step four" );
|
|
|
|
QUnit.start();
|
2012-05-23 03:04:45 +00:00
|
|
|
}, 10 );
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).promise( "queue" ).done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test++, 3, "step three" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2011-04-11 11:40:14 +00:00
|
|
|
|
2012-05-23 03:04:45 +00:00
|
|
|
foo.dequeue( "queue" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2011-12-09 17:41:35 +00:00
|
|
|
|
2015-10-09 19:52:29 +00:00
|
|
|
if ( jQuery.fn.animate ) {
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.asyncTest( "fn.promise( \"queue\" ) - waits for animation to complete before resolving", 2, function( assert ) {
|
2012-08-13 17:43:49 +00:00
|
|
|
var foo = jQuery( "#foo" ),
|
|
|
|
test = 1;
|
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
foo.animate( {
|
2012-08-13 17:43:49 +00:00
|
|
|
top: 100
|
|
|
|
}, {
|
|
|
|
duration: 1,
|
|
|
|
queue: "queue",
|
|
|
|
complete: function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test++, 1, "step one" );
|
2012-08-13 17:43:49 +00:00
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
} ).dequeue( "queue" );
|
2012-08-13 17:43:49 +00:00
|
|
|
|
|
|
|
foo.promise( "queue" ).done( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.strictEqual( test++, 2, "step two" );
|
|
|
|
QUnit.start();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-08-13 17:43:49 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2015-10-09 19:52:29 +00:00
|
|
|
}
|
2012-08-13 17:43:49 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( ".promise(obj)", function( assert ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
assert.expect( 2 );
|
2011-12-09 17:41:35 +00:00
|
|
|
|
2013-04-09 15:45:09 +00:00
|
|
|
var obj = {},
|
|
|
|
promise = jQuery( "#foo" ).promise( "promise", obj );
|
2011-12-09 17:41:35 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( jQuery.isFunction( promise.promise ), ".promise(type, obj) returns a promise" );
|
|
|
|
assert.strictEqual( promise, obj, ".promise(type, obj) returns obj" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-23 03:04:45 +00:00
|
|
|
|
2012-05-29 02:25:04 +00:00
|
|
|
if ( jQuery.fn.stop ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
QUnit.test( "delay() can be stopped", function( assert ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.expect( 3 );
|
|
|
|
QUnit.stop();
|
2012-05-29 02:25:04 +00:00
|
|
|
|
2012-11-08 15:05:10 +00:00
|
|
|
var done = {};
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery( {} )
|
2012-05-29 02:25:04 +00:00
|
|
|
.queue( "alternate", function( next ) {
|
2012-11-08 15:05:10 +00:00
|
|
|
done.alt1 = true;
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( true, "This first function was dequeued" );
|
2012-05-29 02:25:04 +00:00
|
|
|
next();
|
2015-08-16 06:59:58 +00:00
|
|
|
} )
|
2012-05-29 02:25:04 +00:00
|
|
|
.delay( 1000, "alternate" )
|
|
|
|
.queue( "alternate", function() {
|
2012-11-08 15:05:10 +00:00
|
|
|
done.alt2 = true;
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( true, "The function was dequeued immediately, the delay was stopped" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} )
|
2012-05-29 02:25:04 +00:00
|
|
|
.dequeue( "alternate" )
|
|
|
|
|
|
|
|
// stop( "alternate", false ) will NOT clear the queue, so it should automatically dequeue the next
|
|
|
|
.stop( "alternate", false, false )
|
|
|
|
|
|
|
|
// this test
|
2012-11-08 15:05:10 +00:00
|
|
|
.delay( 1 )
|
2015-08-16 06:59:58 +00:00
|
|
|
.queue( function() {
|
2012-11-08 15:05:10 +00:00
|
|
|
done.default1 = true;
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( false, "This queue should never run" );
|
2015-08-16 06:59:58 +00:00
|
|
|
} )
|
2012-05-29 02:25:04 +00:00
|
|
|
|
|
|
|
// stop( clearQueue ) should clear the queue
|
|
|
|
.stop( true, false );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.deepEqual( done, { alt1: true, alt2: true }, "Queue ran the proper functions" );
|
2012-05-29 02:25:04 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
setTimeout( function() {
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.start();
|
2012-11-08 15:05:10 +00:00
|
|
|
}, 1500 );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-23 03:04:45 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.asyncTest( "queue stop hooks", 2, function( assert ) {
|
2012-05-29 02:25:04 +00:00
|
|
|
var foo = jQuery( "#foo" );
|
|
|
|
|
|
|
|
foo.queue( function( next, hooks ) {
|
|
|
|
hooks.stop = function( gotoEnd ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( !!gotoEnd, false, "Stopped without gotoEnd" );
|
2012-05-29 02:25:04 +00:00
|
|
|
};
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-29 02:25:04 +00:00
|
|
|
foo.stop();
|
|
|
|
|
|
|
|
foo.queue( function( next, hooks ) {
|
|
|
|
hooks.stop = function( gotoEnd ) {
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( gotoEnd, true, "Stopped with gotoEnd" );
|
|
|
|
QUnit.start();
|
2012-05-29 02:25:04 +00:00
|
|
|
};
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-29 02:25:04 +00:00
|
|
|
|
|
|
|
foo.stop( false, true );
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2012-05-23 03:04:45 +00:00
|
|
|
|
2012-06-21 19:30:24 +00:00
|
|
|
} // if ( jQuery.fn.stop )
|