mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fixed #1822 bug where queue() didn't always default to type 'fx'.
This commit is contained in:
parent
1d299d375b
commit
0a0990485e
@ -126,7 +126,7 @@ jQuery.fn.extend({
|
||||
},
|
||||
|
||||
queue: function(type, fn){
|
||||
if ( jQuery.isFunction(type) ) {
|
||||
if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
|
||||
fn = type;
|
||||
type = "fx";
|
||||
}
|
||||
@ -162,6 +162,8 @@ var queue = function( elem, type, array ) {
|
||||
if ( !elem )
|
||||
return;
|
||||
|
||||
type = type || "fx";
|
||||
|
||||
var q = jQuery.data( elem, type + "queue" );
|
||||
|
||||
if ( !q || array )
|
||||
|
@ -29,11 +29,28 @@ test("animate option (queue === false)", function () {
|
||||
$foo.animate({height:'100px'}, 10, function() {
|
||||
// queued behind the first animation so should finish third
|
||||
order.push(3);
|
||||
isSet( order, [ 1, 2, 3] );
|
||||
isSet( order, [ 1, 2, 3], "Animations finished in the correct order" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
||||
test("queue() defaults to 'fx' type", function () {
|
||||
expect(2);
|
||||
stop();
|
||||
|
||||
var $foo = $("#foo");
|
||||
$foo.queue("fx", [ "sample", "array" ]);
|
||||
var arr = $foo.queue();
|
||||
isSet(arr, [ "sample", "array" ], "queue() got an array set with type 'fx'");
|
||||
$foo.queue([ "another", "one" ]);
|
||||
var arr = $foo.queue("fx");
|
||||
isSet(arr, [ "another", "one" ], "queue('fx') got an array set with no type");
|
||||
// clean up after test
|
||||
$foo.queue([]);
|
||||
|
||||
start();
|
||||
});
|
||||
|
||||
test("stop()", function() {
|
||||
expect(3);
|
||||
stop();
|
||||
|
Loading…
Reference in New Issue
Block a user