Removed custom method in isDeferred and when.
This commit is contained in:
parent
23d455b446
commit
240d8b681e
2 changed files with 7 additions and 31 deletions
|
@ -1024,7 +1024,7 @@ test("jQuery.Deferred()", function() {
|
|||
|
||||
test("jQuery.isDeferred()", function() {
|
||||
|
||||
expect( 11 );
|
||||
expect( 10 );
|
||||
|
||||
var object1 = { then: function() { return this; } },
|
||||
object2 = { then: function() { return this; } };
|
||||
|
@ -1049,14 +1049,13 @@ test("jQuery.isDeferred()", function() {
|
|||
object1 = {custom: jQuery._Deferred().then};
|
||||
|
||||
ok(!jQuery.isDeferred(object1) , "custom method name not found automagically");
|
||||
ok(jQuery.isDeferred(object1,"custom") , "custom method name");
|
||||
});
|
||||
|
||||
test("jQuery.when()", function() {
|
||||
|
||||
expect( 5 );
|
||||
expect( 2 );
|
||||
|
||||
var cache, i, deferred = { done: jQuery.Deferred().resolve( 1 ).then };
|
||||
var cache, i;
|
||||
|
||||
for( i = 1 ; i < 3 ; i++ ) {
|
||||
jQuery.when( cache || jQuery.Deferred( function() {
|
||||
|
@ -1068,22 +1067,4 @@ test("jQuery.when()", function() {
|
|||
ok( false , "Fail called" );
|
||||
});
|
||||
}
|
||||
|
||||
cache = 0;
|
||||
|
||||
for( i = 1 ; i < 3 ; i++ ) {
|
||||
jQuery.when( cache || deferred , "done" ).done( function( value ) {
|
||||
strictEqual( value , 1 , "Custom method: resolved" + ( i > 1 ? " only once" : "" ) );
|
||||
cache = value;
|
||||
}).fail( function() {
|
||||
ok( false , "Custom method: fail called" );
|
||||
});
|
||||
}
|
||||
|
||||
stop();
|
||||
|
||||
jQuery.when( jQuery( document ) , "ready" ).then( function( test ) {
|
||||
strictEqual( test , jQuery , "jQuery.fn.ready recognized as a deferred" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue