Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
isProgressing becomes isPending. Unit tests added.
- Loading branch information
Showing
with
5 additions
and
2 deletions.
-
+1
−1
src/deferred.js
-
+4
−1
test/unit/deferred.js
|
@@ -21,7 +21,7 @@ jQuery.extend({ |
|
|
|
|
|
isResolved: doneList.fired, |
|
|
isRejected: failList.fired, |
|
|
isProgressing: function() { |
|
|
isPending: function() { |
|
|
return !progressList.locked(); |
|
|
}, |
|
|
|
|
|
|
@@ -8,7 +8,7 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) { |
|
|
|
|
|
test("jQuery.Deferred" + withNew, function() { |
|
|
|
|
|
expect( 14 ); |
|
|
expect( 20 ); |
|
|
|
|
|
createDeferred().resolve().then( function() { |
|
|
ok( true , "Success on resolve" ); |
|
@@ -37,14 +37,17 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) { |
|
|
|
|
|
jQuery.each( "resolve reject".split( " " ), function( _, change ) { |
|
|
createDeferred( function( defer ) { |
|
|
ok( defer.isPending(), "pending after creation" ); |
|
|
var checked = 0; |
|
|
defer.progress(function( value ) { |
|
|
strictEqual( value, checked, "Progress: right value (" + value + ") received" ); |
|
|
}); |
|
|
for( checked = 0; checked < 3 ; checked++ ) { |
|
|
defer.notify( checked ); |
|
|
} |
|
|
ok( defer.isPending(), "pending after notification" ); |
|
|
defer[ change ](); |
|
|
ok( !defer.isPending(), "not pending after " + change ); |
|
|
defer.notify(); |
|
|
}); |
|
|
}); |
|
|