aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-04-08 17:35:08 +0200
committerjaubourg <j@ubourg.net>2011-04-08 17:35:08 +0200
commit7a1c6beab0d92b1419050eb468773bf1138254a6 (patch)
tree75891da7c33843b8a1be56af7a8b8df27872b707
parent98d83ef85f41fefb40a14eec24c6804c088bbeeb (diff)
downloadjquery-7a1c6beab0d92b1419050eb468773bf1138254a6.tar.gz
jquery-7a1c6beab0d92b1419050eb468773bf1138254a6.zip
Renames chain as pipe.
-rw-r--r--src/deferred.js5
-rw-r--r--test/unit/deferred.js32
2 files changed, 18 insertions, 19 deletions
diff --git a/src/deferred.js b/src/deferred.js
index feaccaef3..a25bdb7a5 100644
--- a/src/deferred.js
+++ b/src/deferred.js
@@ -1,7 +1,7 @@
(function( jQuery ) {
var // Promise methods
- promiseMethods = "done fail isResolved isRejected promise then always chain".split( " " ),
+ promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
// Static reference to slice
sliceDeferred = [].slice;
@@ -107,8 +107,7 @@ jQuery.extend({
rejectWith: failDeferred.resolveWith,
reject: failDeferred.resolve,
isRejected: failDeferred.isResolved,
- // Chain
- chain: function( fnDone, fnFail ) {
+ pipe: function( fnDone, fnFail ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
diff --git a/test/unit/deferred.js b/test/unit/deferred.js
index c1ed7c57e..c71fbdbe7 100644
--- a/test/unit/deferred.js
+++ b/test/unit/deferred.js
@@ -143,19 +143,19 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
});
} );
-test( "jQuery.Deferred.chain - filtering (done)", function() {
+test( "jQuery.Deferred.pipe - filtering (done)", function() {
expect(3);
var defer = jQuery.Deferred(),
- chained = defer.chain(function( a, b ) {
+ piped = defer.pipe(function( a, b ) {
return a * b;
}),
value1,
value2,
value3;
- chained.done(function( result ) {
+ piped.done(function( result ) {
value3 = result;
});
@@ -170,24 +170,24 @@ test( "jQuery.Deferred.chain - filtering (done)", function() {
strictEqual( value2, 3, "second resolve value ok" );
strictEqual( value3, 6, "result of filter ok" );
- jQuery.Deferred().reject().chain(function() {
- ok( false, "chain should not be called on reject" );
+ jQuery.Deferred().reject().pipe(function() {
+ ok( false, "pipe should not be called on reject" );
});
});
-test( "jQuery.Deferred.chain - filtering (fail)", function() {
+test( "jQuery.Deferred.pipe - filtering (fail)", function() {
expect(3);
var defer = jQuery.Deferred(),
- chained = defer.chain( null, function( a, b ) {
+ piped = defer.pipe( null, function( a, b ) {
return a * b;
} ),
value1,
value2,
value3;
- chained.fail(function( result ) {
+ piped.fail(function( result ) {
value3 = result;
});
@@ -202,17 +202,17 @@ test( "jQuery.Deferred.chain - filtering (fail)", function() {
strictEqual( value2, 3, "second reject value ok" );
strictEqual( value3, 6, "result of filter ok" );
- jQuery.Deferred().resolve().chain( null, function() {
- ok( false, "chain should not be called on resolve" );
+ jQuery.Deferred().resolve().pipe( null, function() {
+ ok( false, "pipe should not be called on resolve" );
} );
});
-test( "jQuery.Deferred.chain - deferred (done)", function() {
+test( "jQuery.Deferred.pipe - deferred (done)", function() {
expect(3);
var defer = jQuery.Deferred(),
- chained = defer.chain(function( a, b ) {
+ piped = defer.pipe(function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.reject( a * b );
});
@@ -221,7 +221,7 @@ test( "jQuery.Deferred.chain - deferred (done)", function() {
value2,
value3;
- chained.fail(function( result ) {
+ piped.fail(function( result ) {
value3 = result;
});
@@ -237,12 +237,12 @@ test( "jQuery.Deferred.chain - deferred (done)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
-test( "jQuery.Deferred.chain - deferred (fail)", function() {
+test( "jQuery.Deferred.pipe - deferred (fail)", function() {
expect(3);
var defer = jQuery.Deferred(),
- chained = defer.chain( null, function( a, b ) {
+ piped = defer.pipe( null, function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.resolve( a * b );
});
@@ -251,7 +251,7 @@ test( "jQuery.Deferred.chain - deferred (fail)", function() {
value2,
value3;
- chained.done(function( result ) {
+ piped.done(function( result ) {
value3 = result;
});