aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/deferred.js
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-06-21 15:30:24 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-06-21 15:30:24 -0400
commit7ff3da186cf9bb5ea23f5a0b9543302ef0f861f7 (patch)
tree41ebf66ab6fd5fdd4eaef11f022c6c95727d57f4 /test/unit/deferred.js
parent66501469c0c21107837375538a13273e32fdc7cf (diff)
downloadjquery-7ff3da186cf9bb5ea23f5a0b9543302ef0f861f7.tar.gz
jquery-7ff3da186cf9bb5ea23f5a0b9543302ef0f861f7.zip
Unit tests are linted and passing.
Diffstat (limited to 'test/unit/deferred.js')
-rw-r--r--test/unit/deferred.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/unit/deferred.js b/test/unit/deferred.js
index 973560724..de7cd069e 100644
--- a/test/unit/deferred.js
+++ b/test/unit/deferred.js
@@ -324,16 +324,20 @@ test( "jQuery.when" , function() {
strictEqual( this, context, "when( promise ) propagates context" );
});
- var cache, i;
+ var cache;
+
+ jQuery.each([ 1, 2, 3 ], function(k, i) {
- for( i = 1 ; i < 4 ; i++ ) {
jQuery.when( cache || jQuery.Deferred( function() {
- this.resolve( i );
- }) ).done(function( value ) {
- strictEqual( value , 1 , "Function executed" + ( i > 1 ? " only once" : "" ) );
+ this.resolve( i );
+ })
+ ).done(function( value ) {
+
+ strictEqual( value, 1 , "Function executed" + ( i > 1 ? " only once" : "" ) );
cache = value;
});
- }
+
+ });
});
test("jQuery.when - joined", function() {
@@ -369,10 +373,10 @@ test("jQuery.when - joined", function() {
shouldError = willError[ id1 ] || willError[ id2 ],
shouldNotify = willNotify[ id1 ] || willNotify[ id2 ],
expected = shouldResolve ? [ 1, 1 ] : [ 0, undefined ],
- expectedNotify = shouldNotify && [ willNotify[ id1 ], willNotify[ id2 ] ],
- code = id1 + "/" + id2,
- context1 = defer1 && jQuery.isFunction( defer1.promise ) ? defer1 : undefined,
- context2 = defer2 && jQuery.isFunction( defer2.promise ) ? defer2 : undefined;
+ expectedNotify = shouldNotify && [ willNotify[ id1 ], willNotify[ id2 ] ],
+ code = id1 + "/" + id2,
+ context1 = defer1 && jQuery.isFunction( defer1.promise ) ? defer1 : undefined,
+ context2 = defer2 && jQuery.isFunction( defer2.promise ) ? defer2 : undefined;
jQuery.when( defer1, defer2 ).done(function( a, b ) {
if ( shouldResolve ) {