aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-10-19 20:22:44 +0000
committerManolo Carrasco <manolo@apache.org>2011-10-19 20:22:44 +0000
commiteaa822694aa6c5b7b2d8c8aec1b3961406df81a8 (patch)
treee024d85f49f9a0a63f614f50463693c47c1ba4c7
parenta6566b9346216ede05c94aded37f32681ff9977b (diff)
downloadgwtquery-eaa822694aa6c5b7b2d8c8aec1b3961406df81a8.tar.gz
gwtquery-eaa822694aa6c5b7b2d8c8aec1b3961406df81a8.zip
Fix tests
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java12
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java2
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java6
3 files changed, 10 insertions, 10 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 b7937ba8..c91e63ae 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
@@ -450,13 +450,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
}
/**
- * Set element data.
- */
- public static Object data(Element e, String key, String value) {
- return GQuery.data(e, key, value);
- }
-
- /**
* Execute a function around each object
*/
public static void each(JsArrayMixed objects, Function f) {
@@ -661,6 +654,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
/**
* The nodeList of matched elements, modify this using setArray
*/
+ // TODO: remove this and use elements, change return type of get()
private NodeList<Element> nodeList = JavaScriptObject.createArray().cast();
private GQuery previousObject;
@@ -1926,11 +1920,11 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
break;
}
EventsListener.rebind(n.<Element> cast());
-
// GqUi.attachWidget(w);
}
}
- if (newNodes.size() > g.size()) {
+ // TODO: newNodes.size() > g.size() makes testRebind fail
+ if (newNodes.size() >= g.size()) {
g.setArray(newNodes);
}
return this;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java
index 336a4abe..191aab2a 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java
@@ -126,7 +126,7 @@ public class SelectorEngine implements HasSelector {
} else if (s.endsWith(":hidden")) {
nodes = filterByVisibility(select(s.substring(0, s.length() - 7), ctx), false);
} else {
- nodes = select(a.get(1) + "[type=" + a.get(2) + "]", ctx);
+ nodes = select((a.get(1) != null ? a.get(1) : "") + "[type=" + a.get(2) + "]", ctx);
}
} else {
nodes = select(s, ctx);
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java
index 20071608..601d9e99 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java
@@ -687,12 +687,18 @@ public void testUnDelegateAll2(){
public void testRebind() {
final GQuery b = $("<p>content</p>");
+ assertEquals(1, b.size());
+ assertEquals(1, b.get().getLength());
b.click(new Function() {
public void f(Element e){
b.css(CSS.COLOR.with(RGBColor.RED));
}
});
$(e).append(b);
+ // TODO: dom manipulations some times modifies gquery nodelist,
+ // we could remove the nodelist since we maintain a list of elements.
+ assertEquals(1, b.size());
+ assertEquals(1, b.get().getLength());
b.click();
assertEquals("red", $(b).css("color", false));
}