aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-08-27 23:32:10 +0000
committerManolo Carrasco <manolo@apache.org>2011-08-27 23:32:10 +0000
commit9267072869a9373262145a44bd9b1f69b4a085ff (patch)
tree4dff87451da8fde790284031a8be0f76607ca197 /gwtquery-core
parent7f7b467bcc936648c7f31a0bd6732603d7e708f7 (diff)
downloadgwtquery-9267072869a9373262145a44bd9b1f69b4a085ff.tar.gz
gwtquery-9267072869a9373262145a44bd9b1f69b4a085ff.zip
Revert r773, since we can override properties in dom, but preserving the method attr(string, boolean) as a way to set boolean attributes like "checked". The method css(HasValue) has to call to css(String, true): issue99
Diffstat (limited to 'gwtquery-core')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java9
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java4
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java2
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java55
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java74
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java186
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java1
7 files changed, 164 insertions, 167 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 af6debf6..8ef7911a 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
@@ -931,8 +931,13 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
* Set a single property to a value, on all matched elements.
*/
public GQuery attr(String key, String value) {
+ boolean remove = value == null;
for (Element e : elements) {
- setElementAttribute(e, key, value);
+ if (remove) {
+ e.removeAttribute(key);
+ } else {
+ e.setAttribute(key, value);
+ }
}
return this;
}
@@ -1266,7 +1271,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
* Ex : $("#myId").css(CSS.BACKGROUND_COLOR);
*/
public String css(HasCssValue property) {
- return css(property, false);
+ return css(property, true);
}
/**
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java
index 753a15e7..2d0d3d59 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/UiPlugin.java
@@ -68,7 +68,7 @@ public class UiPlugin extends GQuery {
public GQuery scrollParent(final UiPlugin gQueryUi) {
GQuery scrollParent;
- if ("fixed".equals(gQueryUi.css("position"))) {
+ if ("fixed".equals(gQueryUi.css("position", false))) {
return GQuery.$(getViewportElement());
}
@@ -119,7 +119,7 @@ public class UiPlugin extends GQuery {
@Override
protected boolean scrollParentPositionTest(UiPlugin gQueryUi) {
- String position = gQueryUi.css("position");
+ String position = gQueryUi.css("position", false);
return ("absolute".equals(position) || "relative".equals(position) || "static"
.equals(position));
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java
index 1c0ab2c6..d97565b8 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java
@@ -94,7 +94,7 @@ public class PropertiesAnimation extends GQAnimation {
while ((initialColor == null || initialColor.length() == 0 || initialColor.equals("transparent"))
&& current != null) {
- initialColor = GQuery.$(current).css(key);
+ initialColor = GQuery.$(current).css(key, false);
current = !"body".equalsIgnoreCase(current.getTagName())
? current.getParentElement() : null;
}
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
index b7cd195c..e3bd3e9f 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
@@ -158,12 +158,12 @@ public class GQueryCoreTest extends GWTTestCase {
Properties.create("color: 'red', 'font-weight': 'bold', background: 'blue'"));
assertEquals("red", $("p", e).css("color"));
assertEquals("bold", $("p", e).css("font-weight"));
- assertEquals("blue", $("p", e).css("background-color"));
+ assertEquals("blue", $("p", e).css("background-color", false));
// css() camelize and uppercase
$(e).html("<p>Test Paragraph.</p>");
$("p", e).css(Properties.create("COLOR: 'red', 'FONT-WEIGHT': 'bold'"));
- assertEquals("red", $("p", e).css("color"));
+ assertEquals("red", $("p", e).css("color", false));
assertEquals("", $("p", e).css("background"));
}
@@ -599,13 +599,13 @@ public class GQueryCoreTest extends GWTTestCase {
content = "<div id='mainDiv'><div id='subDiv1' class='subDiv'><div id='subSubDiv1'><p id='p1'>child1</p></div></div><div id='subDiv2' class='subDiv'><div id='subSubDiv2'><p id='p2'>child2</p></div></div></div>";
$(e).html(content);
$("p",e).parentsUntil("#mainDiv").css(CSS.COLOR.with(RGBColor.RED));
- assertEquals("red", $("#subDiv1", e).css(CSS.COLOR));
- assertEquals("red", $("#subSubDiv1", e).css(CSS.COLOR));
- assertEquals("red", $("#subDiv2", e).css(CSS.COLOR));
- assertEquals("red", $("#subSubDiv2", e).css(CSS.COLOR));
- assertEquals("", $("#mainDiv", e).css(CSS.COLOR));
- assertEquals("", $("#p1", e).css(CSS.COLOR));
- assertEquals("", $("#p2", e).css(CSS.COLOR));
+ assertEquals("red", $("#subDiv1", e).css(CSS.COLOR, false));
+ assertEquals("red", $("#subSubDiv1", e).css(CSS.COLOR, false));
+ assertEquals("red", $("#subDiv2", e).css(CSS.COLOR, false));
+ assertEquals("red", $("#subSubDiv2", e).css(CSS.COLOR, false));
+ assertEquals("", $("#mainDiv", e).css(CSS.COLOR, false));
+ assertEquals("", $("#p1", e).css(CSS.COLOR, false));
+ assertEquals("", $("#p2", e).css(CSS.COLOR, false));
$("#p1",e).parentsUntil(".subDiv").css(CSS.COLOR.with(RGBColor.YELLOW));
assertEquals("red", $("#subDiv1", e).css(CSS.COLOR));
@@ -764,25 +764,25 @@ public class GQueryCoreTest extends GWTTestCase {
final GQuery sectA = $("#id1");
final GQuery sectB = $("#id2");
final GQuery sectC = $("#id3");
-
+
// hide()
sectA.hide();
- assertEquals("none", sectA.css("display"));
+ assertEquals("none", sectA.css("display", false));
sectB.hide();
- assertEquals("none", sectB.css("display"));
+ assertEquals("none", sectB.css("display", false));
// show()
sectA.show();
- assertEquals("inline", sectA.css("display"));
+ assertEquals("inline", sectA.css("display", false));
sectB.show();
- assertEquals("", sectB.css("display"));
+ assertEquals("", sectB.css("display", false));
// toggle()
- assertEquals("", sectC.css("display"));
+ assertEquals("", sectC.css("display", false));
sectC.toggle();
- assertEquals("none", sectC.css("display"));
+ assertEquals("none", sectC.css("display", false));
sectC.toggle();
- assertEquals("block", sectC.css("display"));
+ assertEquals("block", sectC.css("display", false));
}
public void testSliceMethods() {
@@ -1326,9 +1326,7 @@ public class GQueryCoreTest extends GWTTestCase {
$(parent).click();
- assertEquals("red", $(parent).css(CSS.BACKGROUND_COLOR));
-
-
+ assertEquals("red", $(parent).css(CSS.BACKGROUND_COLOR, false));
}
public void testDetachMethod(){
@@ -1367,12 +1365,9 @@ public class GQueryCoreTest extends GWTTestCase {
assertEquals("parent",$("#parent", e).data("key"));
$("#child", e).click();
- assertEquals("red", $(child).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $(child).css(CSS.BACKGROUND_COLOR, false));
$("#parent", e).click();
- assertEquals("red", $(parent).css(CSS.BACKGROUND_COLOR));
-
-
-
+ assertEquals("red", $(parent).css(CSS.BACKGROUND_COLOR, false));
}
public void testDetachMethodWithFilter(){
@@ -1410,12 +1405,10 @@ public class GQueryCoreTest extends GWTTestCase {
assertEquals(1,$("#parent", e).length());
$(child).click();
- assertEquals("red", $("#child", e).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $("#child", e).css(CSS.BACKGROUND_COLOR, false));
$(parent).click();
- assertEquals("red", $("#parent", e).css(CSS.BACKGROUND_COLOR));
-
-
+ assertEquals("red", $("#parent", e).css(CSS.BACKGROUND_COLOR, false));
}
public void testUnwrapMethod(){
@@ -1758,9 +1751,9 @@ public class GQueryCoreTest extends GWTTestCase {
+"</li>"
+"<li>list item 4</li>"
+"</ul>");
- assertEquals("", $("#l2").css("background-color"));
+ assertEquals("", $("#l2").css("background-color", false));
$("li", e).has("ul").css("background-color", "red");
- assertEquals("red", $("#l2").css("background-color"));
+ assertEquals("red", $("#l2").css("background-color", false));
Element span = $("span", e).get(0);
assertEquals("l3", $("li", e).has(span).id());
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
index 6717393b..9ad7d71e 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
@@ -104,17 +104,17 @@ public class GQueryCssTest extends GWTTestCase {
$("#test").css(CSS.BACKGROUND_COLOR.with(RGBColor.AQUA));
- assertEquals("aqua", $("#test").css("backgroundColor"));
- assertEquals("aqua", $("#test").css(CSS.BACKGROUND_COLOR));
+ assertEquals("aqua", $("#test").css("backgroundColor", false));
+ assertEquals("aqua", $("#test").css(CSS.BACKGROUND_COLOR, false));
$("#test").css(CSS.BACKGROUND_COLOR.with(RGBColor.rgb("#112233")));
- assertEquals("#112233", $("#test").css("backgroundColor"));
- assertEquals("#112233", $("#test").css(CSS.BACKGROUND_COLOR));
+ assertEquals("#112233", $("#test").css("backgroundColor", false));
+ assertEquals("#112233", $("#test").css(CSS.BACKGROUND_COLOR, false));
$("#test").css(CSS.BACKGROUND_COLOR.with(RGBColor.rgb(35, 45, 55)));
- assertEquals("rgb(35,45,55)", $("#test").css("backgroundColor"));
- assertEquals("rgb(35,45,55)", $("#test").css(CSS.BACKGROUND_COLOR));
+ assertEquals("rgb(35,45,55)", $("#test").css("backgroundColor", false));
+ assertEquals("rgb(35,45,55)", $("#test").css(CSS.BACKGROUND_COLOR, false));
}
@@ -372,20 +372,20 @@ public class GQueryCssTest extends GWTTestCase {
assertEquals("20mm", $("#test").css(CSS.BORDER_WIDTH));
$("#test").css(CSS.BORDER_BOTTOM_WIDTH.with(BorderWidth.THICK));
- assertEquals("thick", $("#test").css("borderBottomWidth"));
- assertEquals("thick", $("#test").css(CSS.BORDER_BOTTOM_WIDTH));
+ assertEquals("thick", $("#test").css("borderBottomWidth", false));
+ assertEquals("thick", $("#test").css(CSS.BORDER_BOTTOM_WIDTH, false));
$("#test").css(CSS.BORDER_TOP_WIDTH.with(BorderWidth.THIN));
- assertEquals("thin", $("#test").css("borderTopWidth"));
- assertEquals("thin", $("#test").css(CSS.BORDER_TOP_WIDTH));
+ assertEquals("thin", $("#test").css("borderTopWidth", false));
+ assertEquals("thin", $("#test").css(CSS.BORDER_TOP_WIDTH, false));
$("#test").css(CSS.BORDER_LEFT_WIDTH.with(BorderWidth.THIN));
- assertEquals("thin", $("#test").css("borderLeftWidth"));
- assertEquals("thin", $("#test").css(CSS.BORDER_LEFT_WIDTH));
+ assertEquals("thin", $("#test").css("borderLeftWidth", false));
+ assertEquals("thin", $("#test").css(CSS.BORDER_LEFT_WIDTH, false));
$("#test").css(CSS.BORDER_RIGHT_WIDTH.with(BorderWidth.THICK));
- assertEquals("thick", $("#test").css("borderRightWidth"));
- assertEquals("thick", $("#test").css(CSS.BORDER_RIGHT_WIDTH));
+ assertEquals("thick", $("#test").css("borderRightWidth", false));
+ assertEquals("thick", $("#test").css(CSS.BORDER_RIGHT_WIDTH, false));
}
@@ -644,55 +644,55 @@ public class GQueryCssTest extends GWTTestCase {
assertEquals("10px", $("#test").css(CSS.HEIGHT));
$("#test").css(CSS.HEIGHT.with(Length.cm(10)));
- assertEquals("10cm", $("#test").css(CSS.HEIGHT));
+ assertEquals("10cm", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.em(10)));
- assertEquals("10em", $("#test").css(CSS.HEIGHT));
+ assertEquals("10em", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.ex(10)));
- assertEquals("10ex", $("#test").css(CSS.HEIGHT));
+ assertEquals("10ex", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.in(10)));
- assertEquals("10in", $("#test").css(CSS.HEIGHT));
+ assertEquals("10in", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.mm(10)));
- assertEquals("10mm", $("#test").css(CSS.HEIGHT));
+ assertEquals("10mm", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.pc(10)));
- assertEquals("10pc", $("#test").css(CSS.HEIGHT));
+ assertEquals("10pc", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.pct(10)));
- assertEquals("10%", $("#test").css(CSS.HEIGHT));
+ assertEquals("10%", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.pt(10)));
- assertEquals("10pt", $("#test").css(CSS.HEIGHT));
+ assertEquals("10pt", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.px(10.1)));
- assertEquals("10.1px", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1px", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.cm(10.1)));
- assertEquals("10.1cm", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1cm", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.em(10.1)));
- assertEquals("10.1em", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1em", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.ex(10.1)));
- assertEquals("10.1ex", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1ex", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.in(10.1)));
- assertEquals("10.1in", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1in", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.mm(10.1)));
- assertEquals("10.1mm", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1mm", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.pc(10.1)));
- assertEquals("10.1pc", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1pc", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.pct(10.1)));
- assertEquals("10.1%", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1%", $("#test").css(CSS.HEIGHT, false));
$("#test").css(CSS.HEIGHT.with(Length.pt(10.1)));
- assertEquals("10.1pt", $("#test").css(CSS.HEIGHT));
+ assertEquals("10.1pt", $("#test").css(CSS.HEIGHT, false));
}
@@ -983,8 +983,8 @@ public class GQueryCssTest extends GWTTestCase {
$(e).html("<div id='test'>Content</div>");
$("#test").css(CSS.TEXT_IDENT.with(Length.px(15)));
- assertEquals("15px", $("#test").css("textIdent"));
- assertEquals("15px", $("#test").css(CSS.TEXT_IDENT));
+ assertEquals("15px", $("#test").css("textIdent", false));
+ assertEquals("15px", $("#test").css(CSS.TEXT_IDENT, false));
}
@@ -993,14 +993,14 @@ public class GQueryCssTest extends GWTTestCase {
$(e).html("<div id='test'>Content</div>");
$("#test").css(CSS.TEXT_TRANSFORM.with(TextTransform.UPPERCASE));
- assertEquals("uppercase", $("#test").css("textTransform"));
- assertEquals("uppercase", $("#test").css(CSS.TEXT_TRANSFORM));
+ assertEquals("uppercase", $("#test").css("textTransform", false));
+ assertEquals("uppercase", $("#test").css(CSS.TEXT_TRANSFORM, false));
$("#test").css(CSS.TEXT_TRANSFORM.with(TextTransform.LOWERCASE));
- assertEquals("lowercase", $("#test").css("textTransform"));
+ assertEquals("lowercase", $("#test").css("textTransform", false));
$("#test").css(CSS.TEXT_TRANSFORM.with(TextTransform.CAPITALIZE));
- assertEquals("capitalize", $("#test").css("textTransform"));
+ assertEquals("capitalize", $("#test").css("textTransform", false));
}
public void testUnicodeBidiProperty() {
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 9712d713..b212786b 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
@@ -83,20 +83,20 @@ public class GQueryEventsTest extends GWTTestCase {
$("#div1",e).addClass("clickMe");
$("#div1",e).click();
- assertEquals(RGBColor.RED.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.RED.getCssName(), $("#div1", e).css(CSS.COLOR, false));
$("#div1",e).dblclick();
- assertEquals(RGBColor.BLUE.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLUE.getCssName(), $("#div1", e).css(CSS.COLOR, false));
//reset
$("#div1",e).css(CSS.COLOR.with(RGBColor.BLACK));
$(".clickMe", e).die("click");
$("#div1",e).click();
- assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR, false));
$("#div1",e).dblclick();
- assertEquals(RGBColor.BLUE.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLUE.getCssName(), $("#div1", e).css(CSS.COLOR, false));
//reset
$("#div1",e).css(CSS.COLOR.with(RGBColor.BLACK));
@@ -104,7 +104,7 @@ public class GQueryEventsTest extends GWTTestCase {
$(".clickMe", e).die("dblclick");
$("#div1",e).dblclick();
- assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR, false));
}
@@ -125,10 +125,10 @@ public class GQueryEventsTest extends GWTTestCase {
$("#div1",e).addClass("clickMe");
$("#div1",e).click();
- assertEquals(RGBColor.RED.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.RED.getCssName(), $("#div1", e).css(CSS.COLOR, false));
$("#div1",e).dblclick();
- assertEquals(RGBColor.BLUE.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLUE.getCssName(), $("#div1", e).css(CSS.COLOR, false));
//reset
$("#div1",e).css(CSS.COLOR.with(RGBColor.BLACK));
@@ -136,10 +136,10 @@ public class GQueryEventsTest extends GWTTestCase {
$(".clickMe", e).die();
$("#div1",e).click();
- assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR, false));
$("#div1",e).dblclick();
- assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR));
+ assertEquals(RGBColor.BLACK.getCssName(), $("#div1", e).css(CSS.COLOR, false));
}
@@ -156,7 +156,7 @@ public class GQueryEventsTest extends GWTTestCase {
}
});
$("p", e).dblclick();
- assertEquals("yellow", $("p", e).css("color"));
+ assertEquals("yellow", $("p", e).css("color", false));
}
public void testEventsPlugin() {
@@ -173,14 +173,14 @@ public class GQueryEventsTest extends GWTTestCase {
}
});
$("p", e, Events.Events).trigger(Event.ONCLICK);
- assertEquals("red", $("p", e).css("color"));
- assertEquals("green", $("p", e).css("background-color"));
+ assertEquals("red", $("p", e).css("color", false));
+ assertEquals("green", $("p", e).css("background-color", false));
// unbind
$("p", e).css(CSS.COLOR.with(RGBColor.WHITE));
$("p", e).unbind(Event.ONCLICK);
$("p", e).click();
- assertEquals("white", $("p", e).css("color"));
+ assertEquals("white", $("p", e).css("color", false));
// toggle
$("p", e).unbind(Event.ONCLICK);
@@ -194,9 +194,9 @@ public class GQueryEventsTest extends GWTTestCase {
}
});
$("p", e).click();
- assertEquals("red", $("p", e).css("color"));
+ assertEquals("red", $("p", e).css("color", false));
$("p", e).click();
- assertEquals("blue", $("p", e).css("color"));
+ assertEquals("blue", $("p", e).css("color", false));
// one
$("p", e).unbind(Event.ONCLICK);
@@ -206,10 +206,10 @@ public class GQueryEventsTest extends GWTTestCase {
}
});
$("p", e).click();
- assertEquals("red", $("p", e).css("color"));
+ assertEquals("red", $("p", e).css("color", false));
$("p", e).css(CSS.COLOR.with(RGBColor.WHITE));
$("p", e).click();
- assertEquals("white", $("p", e).css("color"));
+ assertEquals("white", $("p", e).css("color", false));
// hover (mouseover, mouseout)
$("p", e).hover(new Function() {
@@ -222,9 +222,9 @@ public class GQueryEventsTest extends GWTTestCase {
}
});
$("p", e).trigger(Event.ONMOUSEOVER);
- assertEquals("yellow", $("p", e).css("background-color"));
+ assertEquals("yellow", $("p", e).css("background-color", false));
$("p", e).trigger(Event.ONMOUSEOUT);
- assertEquals("white", $("p", e).css("background-color"));
+ assertEquals("white", $("p", e).css("background-color", false));
// // focus
// FIXME: Html 2.1.0 failing but FF do not
@@ -234,9 +234,9 @@ public class GQueryEventsTest extends GWTTestCase {
// }
// });
// $("p", e).focus();
-// assertEquals("black", $("p", e).css("border-top-color"));
-// assertEquals("dotted", $("p", e).css("border-top-style"));
-// assertEquals("1px", $("p", e).css("border-top-width"));
+// assertEquals("black", $("p", e).css("border-top-color", false));
+// assertEquals("dotted", $("p", e).css("border-top-style", false));
+// assertEquals("1px", $("p", e).css("border-top-width", false));
//
// // blur
// $("p", e).blur(new Function() {
@@ -245,7 +245,7 @@ public class GQueryEventsTest extends GWTTestCase {
// }
// });
// $("p", e).blur();
-// assertEquals("", $("p", e).css("border"));
+// assertEquals("", $("p", e).css("border", false));
// key events
$(e).html("<input type='text'/>");
@@ -268,67 +268,67 @@ public class GQueryEventsTest extends GWTTestCase {
public void testLazyMethods() {
$(e).css(CSS.COLOR.with(RGBColor.WHITE));
- assertEquals("white", $(e).css("color"));
+ assertEquals("white", $(e).css("color", false));
$(e).one(Event.ONCLICK, null, lazy().css(CSS.COLOR.with(RGBColor.RED)).done());
$(e).click();
- assertEquals("red", $(e).css("color"));
+ assertEquals("red", $(e).css("color", false));
$(e).click(lazy().css(CSS.COLOR.with(RGBColor.BLACK)).done());
$(e).click();
- assertEquals("black", $(e).css("color"));
+ assertEquals("black", $(e).css("color", false));
}
public void testLive() {
$(e).html("<div id='div1' class='clickMe'><div id='div2'>Content 1<span id='span1'> blop</span></div></div>");
$(".clickMe", e).live("click", new Function(){
- public void f(Element el) {
- $(el).css("color", "red");
+ public void f() {
+ $(this).css("color", "red");
+ System.out.println($(this));
}
});
$(e).append("<div id='div3' class='clickMe'>Content 2 <div id='div4'><span id='span2'>blop</span></div></div>");
-
+
$(".clickMe", e).click();
- assertEquals("red", $("#div1", e).css("color"));
- assertEquals("red", $("#div3", e).css("color"));
+ assertEquals("red", $("#div1", e).css("color", false));
+ assertEquals("red", $("#div3", e).css("color", false));
//reset
$("*", e).css(CSS.COLOR.with(RGBColor.BLACK));
- assertEquals("black", $("div", e).css("color"));
- assertEquals("black", $("span", e).css("color"));
+ assertEquals("black", $("div", e).css("color", false));
+ assertEquals("black", $("span", e).css("color", false));
$("#span1", e).click();
- assertEquals("red", $("#div1", e).css("color"));
- assertEquals("black", $("#div3", e).css("color"));
+ assertEquals("red", $("#div1", e).css("color", false));
+ assertEquals("black", $("#div3", e).css("color", false));
//reset
$("*", e).css(CSS.COLOR.with(RGBColor.BLACK));
$("#span2", e).click();
- assertEquals("black", $("#div1", e).css("color"));
- assertEquals("red", $("#div3", e).css("color"));
+ assertEquals("black", $("#div1", e).css("color", false));
+ assertEquals("red", $("#div3", e).css("color", false));
//reset
- $("*", e).css(CSS.COLOR.with(RGBColor.BLACK));
+ $("*", e).removeClass("clickMe").css(CSS.COLOR.with(RGBColor.BLACK));
$("#div2, #div4", e).addClass("clickMe");
$("#span1", e).click();
- assertEquals("red", $("#div1", e).css("color"));
- assertEquals("red", $("#div2", e).css("color"));
- assertEquals("black", $("#div3", e).css("color"));
- assertEquals("black", $("#div4", e).css("color"));
+ assertEquals("black", $("#div1", e).css("color", false));
+ assertEquals("red", $("#div2", e).css("color", false));
+ assertEquals("black", $("#div3", e).css("color", false));
+ assertEquals("black", $("#div4", e).css("color", false));
- //reset
+ //reset
$("*", e).css(CSS.COLOR.with(RGBColor.BLACK));
$("#span2", e).click();
- assertEquals("black", $("#div1", e).css("color"));
- assertEquals("black", $("#div2", e).css("color"));
- assertEquals("red", $("#div3", e).css("color"));
- assertEquals("red", $("#div4", e).css("color"));
-
+ assertEquals("black", $("#div1", e).css("color", false));
+ assertEquals("black", $("#div2", e).css("color", false));
+ assertEquals("black", $("#div3", e).css("color", false));
+ assertEquals("red", $("#div4", e).css("color", false));
}
public void testLive2() {
@@ -358,10 +358,10 @@ public class GQueryEventsTest extends GWTTestCase {
$("#span1", e).click();
- assertEquals("red", $("#div1", e).css(CSS.COLOR));
- assertEquals("blue", $("#div2", e).css(CSS.COLOR));
+ assertEquals("red", $("#div1", e).css(CSS.COLOR, false));
+ assertEquals("blue", $("#div2", e).css(CSS.COLOR, false));
//ensure taht handler related to mouseover event was not called
- assertNotSame("yellow", $("#div2", e).css(CSS.BACKGROUND_COLOR));
+ assertNotSame("yellow", $("#div2", e).css(CSS.BACKGROUND_COLOR, false));
}
@@ -378,7 +378,7 @@ public class GQueryEventsTest extends GWTTestCase {
$("#div1", e).addClass("clickable");
$("#span1", e).click();
- assertEquals("red", $("#div1", e).css(CSS.COLOR));
+ assertEquals("red", $("#div1", e).css(CSS.COLOR, false));
}
@@ -400,8 +400,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("#span1", e).click();
- assertEquals("red", $("#div1", e).css(CSS.COLOR));
- assertNotSame("yellow", $("#div1", e).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $("#div1", e).css(CSS.COLOR, false));
+ assertNotSame("yellow", $("#div1", e).css(CSS.BACKGROUND_COLOR, false));
}
@@ -436,8 +436,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("red", $(el).css(CSS.COLOR));
- assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $(el).css(CSS.COLOR, false));
+ assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR, false));
}
@@ -474,8 +474,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("red", $(el).css(CSS.COLOR));
- assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $(el).css(CSS.COLOR, false));
+ assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR, false));
//reset
$(el).css(CSS.COLOR.with(RGBColor.BLACK), CSS.BACKGROUND_COLOR.with(RGBColor.WHITE));
}
@@ -485,8 +485,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("black", $(el).css(CSS.COLOR));
- assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("black", $(el).css(CSS.COLOR, false));
+ assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR, false));
//reset
$(el).css(CSS.COLOR.with(RGBColor.BLACK), CSS.BACKGROUND_COLOR.with(RGBColor.WHITE));
}
@@ -496,8 +496,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("black", $(el).css(CSS.COLOR));
- assertEquals("white", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("black", $(el).css(CSS.COLOR, false));
+ assertEquals("white", $(el).css(CSS.BACKGROUND_COLOR, false));
}
}
@@ -531,8 +531,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("red", $(el).css(CSS.COLOR));
- assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $(el).css(CSS.COLOR, false));
+ assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR, false));
//reset
$(el).css(CSS.COLOR.with(RGBColor.BLACK), CSS.BACKGROUND_COLOR.with(RGBColor.WHITE));
}
@@ -542,8 +542,8 @@ public class GQueryEventsTest extends GWTTestCase {
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("black", $(el).css(CSS.COLOR));
- assertEquals("white", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("black", $(el).css(CSS.COLOR, false));
+ assertEquals("white", $(el).css(CSS.BACKGROUND_COLOR, false));
}
}
@@ -577,8 +577,8 @@ public void testUnDelegateAll2(){
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("red", $(el).css(CSS.COLOR));
- assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("red", $(el).css(CSS.COLOR, false));
+ assertEquals("yellow", $(el).css(CSS.BACKGROUND_COLOR, false));
//reset
$(el).css(CSS.COLOR.with(RGBColor.BLACK), CSS.BACKGROUND_COLOR.with(RGBColor.WHITE));
}
@@ -588,8 +588,8 @@ public void testUnDelegateAll2(){
$("span",e).click().trigger(Event.ONMOUSEOVER);
for (Element el : $(".subDiv",e).elements()){
- assertEquals("black", $(el).css(CSS.COLOR));
- assertEquals("white", $(el).css(CSS.BACKGROUND_COLOR));
+ assertEquals("black", $(el).css(CSS.COLOR, false));
+ assertEquals("white", $(el).css(CSS.BACKGROUND_COLOR, false));
}
}
@@ -610,12 +610,12 @@ public void testUnDelegateAll2(){
$("#div1", e).click();
- assertEquals("red", $("#div1", e).css(CSS.COLOR));
+ assertEquals("red", $("#div1", e).css(CSS.COLOR, false));
$("#div1", e).css(CSS.COLOR.with(RGBColor.BLACK));
$("#div1", e).trigger(Event.ONMOUSEOVER);
- assertEquals("red", $("#div1", e).css(CSS.COLOR));
+ assertEquals("red", $("#div1", e).css(CSS.COLOR, false));
$(".myClass2", e).live(Event.ONCLICK|Event.ONMOUSEDOWN, new Function(){
public void f(Element e) {
@@ -627,12 +627,12 @@ public void testUnDelegateAll2(){
$("#div2", e).click();
- assertEquals("yellow", $("#div2", e).css(CSS.COLOR));
+ assertEquals("yellow", $("#div2", e).css(CSS.COLOR, false));
$("#div2", e).css(CSS.COLOR.with(RGBColor.BLACK));
$("#div2", e).trigger(Event.ONMOUSEDOWN);
- assertEquals("yellow", $("#div2", e).css(CSS.COLOR));
+ assertEquals("yellow", $("#div2", e).css(CSS.COLOR, false));
@@ -658,31 +658,31 @@ public void testUnDelegateAll2(){
}
});
$("p", e, Events.Events).trigger(Event.ONCLICK);
- assertEquals("red", $("p", e).css("color"));
- assertEquals("green", $("p", e).css("background-color"));
+ assertEquals("red", $("p", e).css("color", false));
+ assertEquals("green", $("p", e).css("background-color", false));
assertEquals(24.0d, $("p", e).cur("fontSize", true));
$("p", e).css(CSS.COLOR.with(null)).css(CSS.BACKGROUND_COLOR,"").css(CSS.FONT_SIZE.with(Length.px(12)));
- assertFalse("red".equalsIgnoreCase($("p", e).css("color")));
- assertFalse("green".equalsIgnoreCase($("p", e).css("background-color")));
+ assertFalse("red".equalsIgnoreCase($("p", e).css("color", false)));
+ assertFalse("green".equalsIgnoreCase($("p", e).css("background-color", false)));
assertEquals(12.0d, $("p", e).cur("fontSize", true));
$("p", e, Events.Events).unbind("click.first.namespace");
$("p", e, Events.Events).trigger(Event.ONCLICK);
- assertFalse("red".equalsIgnoreCase($("p", e).css("color")));
- assertEquals("green", $("p", e).css("background-color"));
+ assertFalse("red".equalsIgnoreCase($("p", e).css("color", false)));
+ assertEquals("green", $("p", e).css("background-color", false));
assertEquals(24.0d, $("p", e).cur("fontSize", true));
$("p", e).css(CSS.COLOR.with(null)).css(CSS.BACKGROUND_COLOR,"").css(CSS.FONT_SIZE.with(Length.px(12)));
- assertFalse("red".equalsIgnoreCase($("p", e).css("color")));
- assertFalse("green".equalsIgnoreCase($("p", e).css("background-color")));
+ assertFalse("red".equalsIgnoreCase($("p", e).css("color", false)));
+ assertFalse("green".equalsIgnoreCase($("p", e).css("background-color", false)));
assertEquals(12.0d, $("p", e).cur("fontSize", true));
$("p", e, Events.Events).unbind("click");
$("p", e, Events.Events).trigger(Event.ONCLICK);
- assertFalse("red".equalsIgnoreCase($("p", e).css("color")));
- assertFalse("green".equalsIgnoreCase($("p", e).css("background-color")));
+ assertFalse("red".equalsIgnoreCase($("p", e).css("color", false)));
+ assertFalse("green".equalsIgnoreCase($("p", e).css("background-color", false)));
assertEquals(12.0d, $("p", e).cur("fontSize", true));
}
@@ -695,7 +695,7 @@ public void testUnDelegateAll2(){
});
$(e).append(b);
b.click();
- assertEquals("red", $(b).css("color"));
+ assertEquals("red", $(b).css("color", false));
}
@DoNotRunWith({Platform.HtmlUnitLayout})
@@ -793,15 +793,15 @@ public void testUnDelegateAll2(){
}
});
$(document).trigger(Event.ONMOUSEMOVE);
- assertEquals("red", $("p").css("color"));
+ assertEquals("red", $("p").css("color", false));
$(document).trigger(Event.ONMOUSEUP);
- assertEquals("yellow", $("p").css("color"));
+ assertEquals("yellow", $("p").css("color", false));
$("p").css(CSS.COLOR.with(RGBColor.BLACK));
$(document).unbind(Event.ONMOUSEUP|Event.ONMOUSEMOVE);
$(document).trigger(Event.ONMOUSEMOVE);
- assertEquals("black", $("p").css("color"));
+ assertEquals("black", $("p").css("color", false));
$(document).trigger(Event.ONMOUSEUP);
- assertEquals("black", $("p").css("color"));
+ assertEquals("black", $("p").css("color", false));
}
public void testWidgetEvents() {
@@ -815,15 +815,15 @@ public void testUnDelegateAll2(){
$(b).click(lazy().css(CSS.COLOR.with(RGBColor.RED)).done());
$(b).click();
- assertEquals("red", $("button").css("color"));
- assertEquals("black", $("button").css("background-color"));
+ assertEquals("red", $("button").css("color", false));
+ assertEquals("black", $("button").css("background-color", false));
RootPanel.get().remove(b);
$(e).append($(b));
$(b).css(CSS.COLOR.with(RGBColor.YELLOW), CSS.BACKGROUND_COLOR.with(RGBColor.BLUE));
$(b).click();
- assertEquals("red", $("button").css("color"));
- assertEquals("black", $("button").css("background-color"));
+ assertEquals("red", $("button").css("color", false));
+ assertEquals("black", $("button").css("background-color", false));
}
}
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java
index 2829b4c4..9a9ee9d0 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java
@@ -18,7 +18,6 @@ package com.google.gwt.query.client;
import static com.google.gwt.query.client.GQuery.$;
import static com.google.gwt.query.client.GQuery.document;
-import com.google.gwt.dom.client.ButtonElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;