@@ -273,7 +273,7 @@ test( "jQuery.Deferred.then - deferred (progress)", function() {
273273
274274test ( "jQuery.Deferred.then - context" , function ( ) {
275275
276- expect ( 4 ) ;
276+ expect ( 7 ) ;
277277
278278 var context = { } ;
279279
@@ -284,6 +284,12 @@ test( "jQuery.Deferred.then - context", function() {
284284 strictEqual ( value , 6 , "proper value received" ) ;
285285 } ) ;
286286
287+ jQuery . Deferred ( ) . resolve ( ) . then ( function ( ) {
288+ return jQuery . Deferred ( ) . resolveWith ( context ) ;
289+ } ) . done ( function ( ) {
290+ strictEqual ( this , context , "custom context of returned deferred correctly propagated" ) ;
291+ } ) ;
292+
287293 var defer = jQuery . Deferred ( ) ,
288294 piped = defer . then ( function ( value ) {
289295 return value * 3 ;
@@ -295,6 +301,16 @@ test( "jQuery.Deferred.then - context", function() {
295301 strictEqual ( this , piped , "default context gets updated to latest promise in the chain" ) ;
296302 strictEqual ( value , 6 , "proper value received" ) ;
297303 } ) ;
304+
305+ var defer2 = jQuery . Deferred ( ) ,
306+ piped2 = defer2 . then ( ) ;
307+
308+ defer2 . resolve ( 2 ) ;
309+
310+ piped2 . done ( function ( value ) {
311+ strictEqual ( this , piped2 , "default context gets updated to latest promise in the chain (without passing function)" ) ;
312+ strictEqual ( value , 2 , "proper value received (without passing function)" ) ;
313+ } ) ;
298314} ) ;
299315
300316test ( "jQuery.when" , function ( ) {
0 commit comments