resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special ),
resolve( maxDepth, deferred, Identity,
- deferred.notify )
+ deferred.notifyWith )
);
}
} );
} );
+QUnit.test( "jQuery.Deferred - resolved to a notifying deferred", function( assert ) {
+
+ assert.expect( 2 );
+
+ var deferred = jQuery.Deferred(),
+ done = assert.async( 2 );
+
+ deferred.resolve( jQuery.Deferred( function( notifyingDeferred ) {
+ notifyingDeferred.notify( "foo", "bar" );
+ notifyingDeferred.resolve( "baz", "quux" );
+ } ) );
+
+ // Apply an empty then to force thenable unwrapping.
+ // See https://github.com/jquery/jquery/issues/3000 for more info.
+ deferred.then().then( function() {
+ assert.deepEqual(
+ [].slice.call( arguments ),
+ [ "baz", "quux" ],
+ "The fulfilled handler receives proper params"
+ );
+ done();
+ }, null, function() {
+ assert.deepEqual(
+ [].slice.call( arguments ),
+ [ "foo", "bar" ],
+ "The progress handler receives proper params"
+ );
+ done();
+ } );
+} );
QUnit.test( "jQuery.when(nonThenable) - like Promise.resolve", function( assert ) {
"use strict";