diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2016-01-11 19:10:28 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2016-01-13 12:21:17 -0500 |
commit | bdf1b8f317d793d8ebbbe7787955edabf201a685 (patch) | |
tree | 0bc93297874f9c38d3891199336ae2738b36c3e3 /test | |
parent | f5fb8d71cb20bdbe1b536d05a0b40b503e4e1a43 (diff) | |
download | jquery-bdf1b8f317d793d8ebbbe7787955edabf201a685.tar.gz jquery-bdf1b8f317d793d8ebbbe7787955edabf201a685.zip |
Deferred: Remove undocumented progress notifications in $.when
Fixes gh-2710
Closes gh-2816
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/deferred.js | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/test/unit/deferred.js b/test/unit/deferred.js index 1a721d1ee..83c2f4f6b 100644 --- a/test/unit/deferred.js +++ b/test/unit/deferred.js @@ -710,13 +710,12 @@ QUnit.test( "jQuery.when", function( assert ) { QUnit.test( "jQuery.when - joined", function( assert ) { - assert.expect( 195 ); + assert.expect( 81 ); var deferreds = { rawValue: 1, fulfilled: jQuery.Deferred().resolve( 1 ), rejected: jQuery.Deferred().reject( 0 ), - notified: jQuery.Deferred().notify( true ), eventuallyFulfilled: jQuery.Deferred().notify( true ), eventuallyRejected: jQuery.Deferred().notify( true ), fulfilledStandardPromise: Promise.resolve( 1 ), @@ -733,11 +732,6 @@ QUnit.test( "jQuery.when - joined", function( assert ) { eventuallyRejected: true, rejectedStandardPromise: true }, - willNotify = { - notified: true, - eventuallyFulfilled: true, - eventuallyRejected: true - }, counter = 49; QUnit.stop(); @@ -752,9 +746,7 @@ QUnit.test( "jQuery.when - joined", function( assert ) { jQuery.each( deferreds, function( id2, defer2 ) { var shouldResolve = willSucceed[ id1 ] && willSucceed[ id2 ], shouldError = willError[ id1 ] || willError[ id2 ], - shouldNotify = willNotify[ id1 ] || willNotify[ id2 ], expected = shouldResolve ? [ 1, 1 ] : [ 0, undefined ], - expectedNotify = shouldNotify && [ willNotify[ id1 ], willNotify[ id2 ] ], code = "jQuery.when( " + id1 + ", " + id2 + " )", context1 = defer1 && jQuery.isFunction( defer1.promise ) ? defer1.promise() : window, context2 = defer2 && jQuery.isFunction( defer2.promise ) ? defer2.promise() : window; @@ -773,10 +765,6 @@ QUnit.test( "jQuery.when - joined", function( assert ) { } else { assert.ok( false, code + " => reject" ); } - } ).progress( function( a, b ) { - assert.deepEqual( [ a, b ], expectedNotify, code + " => progress" ); - assert.strictEqual( this[ 0 ], expectedNotify[ 0 ] ? context1 : undefined, code + " => first context OK" ); - assert.strictEqual( this[ 1 ], expectedNotify[ 1 ] ? context2 : undefined, code + " => second context OK" ); } ).always( restart ); } ); } ); @@ -784,19 +772,15 @@ QUnit.test( "jQuery.when - joined", function( assert ) { deferreds.eventuallyRejected.reject( 0 ); } ); -QUnit.test( "jQuery.when - resolved", function( assert ) { +QUnit.test( "jQuery.when - notify does not affect resolved", function( assert ) { - assert.expect( 6 ); + assert.expect( 3 ); var a = jQuery.Deferred().notify( 1 ).resolve( 4 ), b = jQuery.Deferred().notify( 2 ).resolve( 5 ), c = jQuery.Deferred().notify( 3 ).resolve( 6 ); - jQuery.when( a, b, c ).progress( function( a, b, c ) { - assert.strictEqual( a, 1, "first notify value ok" ); - assert.strictEqual( b, 2, "second notify value ok" ); - assert.strictEqual( c, 3, "third notify value ok" ); - } ).done( function( a, b, c ) { + jQuery.when( a, b, c ).done( function( a, b, c ) { assert.strictEqual( a, 4, "first resolve value ok" ); assert.strictEqual( b, 5, "second resolve value ok" ); assert.strictEqual( c, 6, "third resolve value ok" ); |