From 70ca4448c79e96c0b2e4bf7541bd08d36bd3774b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Sat, 9 Nov 2013 12:05:45 +0100 Subject: [PATCH] Fix "or" tests. Remove javadoc line --- .../main/java/com/google/gwt/query/client/Promise.java | 2 -- .../gwt/query/client/plugins/deferred/Deferred.java | 9 ++------- .../google/gwt/query/client/deferred/DeferredTest.java | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Promise.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Promise.java index cc2b0f61..c35b10f5 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Promise.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Promise.java @@ -108,8 +108,6 @@ public interface Promise { * It works in the same way than adding a second parameter to {@link then} method but * continuing the flow and making more readable the code. * - * NOTE: this method is in gQuery but not in jQuery. - * * Example: *
      GQuery.when(gettingConfigurationFromCache())
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/Deferred.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/Deferred.java
index c07fee40..58dcf461 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/Deferred.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/Deferred.java
@@ -68,14 +68,9 @@ public class Deferred implements Promise.Deferred {
               }});
             } else {
               p.always(new Function(){public void f() {
-                if (p.isRejected() && !cont) {
-                  settle(FAIL, getArguments());
-                } else {
-                  settle(DONE, getArguments());
-                }
+                settle((type == DONE || type == FAIL && cont) && p.isResolved() ? DONE : FAIL, getArguments());
               }});
             }
-          
           } else {
             // Otherwise we change the arguments by the new ones
             newArgs = Boolean.TRUE.equals(newArgs) ? oldArgs :
@@ -163,7 +158,7 @@ public class Deferred implements Promise.Deferred {
     }
     
     public Promise or(final Function f) {
-      return then(false, null, f);
+      return then(true, null, f);
     }   
     
     public Promise pipe(Function... f) {
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/deferred/DeferredTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/deferred/DeferredTest.java
index 8537b34b..45eb6064 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/deferred/DeferredTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/deferred/DeferredTest.java
@@ -309,7 +309,7 @@ public class DeferredTest extends GWTTestCase {
             dfd.reject(arguments[0] + " reject-or2");
           }
       })
-      .then(null, new FunctionDeferred() {
+      .or(new FunctionDeferred() {
           public void f(Deferred dfd) {
             dfd.resolve(arguments[0] + " resolve-or3");
           }
-- 
2.39.5