From c6a06834dc0ed891c1dec4ab58332abd22865ca8 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Thu, 29 Jan 2015 12:36:07 +0100 Subject: [PATCH] Fix tests --- .../src/main/java/com/google/gwt/query/client/GQuery.java | 2 +- .../com/google/gwt/query/client/plugins/ajax/Ajax.java | 7 +++---- .../com/google/gwt/query/client/GQueryCoreTestGwt.java | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index ba59cadd..92641bf8 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -287,7 +287,7 @@ public class GQuery implements Lazy { return $(JsUtils. cast(o)); } if (o instanceof JsonBuilder) { - return new GQuery(((JsonBuilder) o).getDataImpl()); + return new GQuery(((JsonBuilder) o).getDataImpl()); } if (o instanceof JavaScriptObject) { return $((JavaScriptObject) o); diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java index 814a58e2..429b00eb 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java @@ -391,8 +391,7 @@ public class Ajax extends GQuery { } public static Promise loadScript(final String url, Function success) { - GQuery script = $("script[src^='" + url + "']"); - if (script.isEmpty()) { + if (!GWT.isClient() || $("script[src^='" + url + "']").isEmpty()) { return ajax(createSettings() .setUrl(url) .setType("get") @@ -463,11 +462,11 @@ public class Ajax extends GQuery { return this; } - public static Promise loadLink(String rel, String url) { + public static Promise loadLink(final String rel, final String url) { GQuery link = $("link[rel='" + rel + "'][href^='" + url + "']"); if (link.isEmpty()) { return new PromiseFunction() { - public void f(Deferred dfd) { + public void f(final Deferred dfd) { GQuery link = $(""); link.on("load", new Function() { public void f() { diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java index 54181621..3c76a811 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java @@ -578,8 +578,8 @@ public class GQueryCoreTestGwt extends GWTTestCase { public void testPropMethod(){ $(e).html(" "); - assertEquals(true, $("#checkBox1",e).prop("checked")); - assertEquals(false, $("#checkBox2",e).prop("checked")); + assertEquals(Boolean.TRUE, $("#checkBox1",e).prop("checked")); + assertEquals(Boolean.FALSE, $("#checkBox2",e).prop("checked")); $("#checkBox1",e).prop("checked", false); $("#checkBox2",e).prop("checked", new Function() { @@ -588,8 +588,8 @@ public class GQueryCoreTestGwt extends GWTTestCase { return Boolean.TRUE; } }); - assertEquals(true, $("#checkBox2",e).prop("checked")); - assertEquals(false, $("#checkBox1",e).prop("checked")); + assertEquals(Boolean.TRUE, $("#checkBox2",e).prop("checked")); + assertEquals(Boolean.FALSE, $("#checkBox1",e).prop("checked")); $(window).prop("foo", 234); assertEquals(234d, $(window).prop("foo")); -- 2.39.5