aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Dramaix <julien.dramaix@gmail.com>2011-04-10 19:58:50 +0000
committerJulien Dramaix <julien.dramaix@gmail.com>2011-04-10 19:58:50 +0000
commit88a468430f75dcb02f5137391c9cd2e9f78f3673 (patch)
tree47e9e9287d52e0464e1c154984959b71dbbb1a5c
parentdfed14a9a89afe204ef84642968301fbee1a548f (diff)
downloadgwtquery-88a468430f75dcb02f5137391c9cd2e9f78f3673.tar.gz
gwtquery-88a468430f75dcb02f5137391c9cd2e9f78f3673.zip
add testLiveWithEventBit and testLiveWithMultipleEvent tests !
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java61
1 files changed, 59 insertions, 2 deletions
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 876ee78d..8eeaf2bf 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
@@ -359,12 +359,29 @@ public class GQueryEventsTest extends GWTTestCase {
assertEquals("red", $("#div1", e).css(CSS.COLOR));
assertEquals("blue", $("#div2", e).css(CSS.COLOR));
+ //ensure taht handler related to mouseover event was not called
assertNotSame("yellow", $("#div2", e).css(CSS.BACKGROUND_COLOR));
}
-public void testLiveWithMultipleFunction() {
+ public void testLiveWithEventBit() {
+ $(e).html("<div id='div1'><div id='div2'>Content 1<span id='span1'> blop</span></div></div>");
+
+ $(".clickable", e).live(Event.ONCLICK, new Function(){
+ public void f(Element e) {
+ $(e).css(CSS.COLOR.with(RGBColor.RED));
+ }
+ });
+
+ $("#div1", e).addClass("clickable");
+ $("#span1", e).click();
+
+ assertEquals("red", $("#div1", e).css(CSS.COLOR));
+
+ }
+
+ public void testLiveWithMultipleFunction() {
$(e).html("<div id='div1'><div id='div2'>Content 1<span id='span1'> blop</span></div></div>");
@@ -388,7 +405,47 @@ public void testLiveWithMultipleFunction() {
}
-
+ public void testLiveWithMultipleEvent() {
+
+ $(e).html("<div id='div1'><div id='div2'>Content 1<span id='span1'> blop</span></div></div>");
+
+ $(".myClass", e).live("click mouseover", new Function(){
+ public void f(Element e) {
+ $(e).css(CSS.COLOR.with(RGBColor.RED));
+ }
+ });
+
+ $("#div1", e).addClass("myClass");
+
+ $("#div1", e).click();
+
+ assertEquals("red", $("#div1", e).css(CSS.COLOR));
+
+ $("#div1", e).css(CSS.COLOR.with(RGBColor.BLACK));
+
+ $("#div1", e).trigger(Event.ONMOUSEOVER);
+ assertEquals("red", $("#div1", e).css(CSS.COLOR));
+
+ $(".myClass2", e).live(Event.ONCLICK|Event.ONMOUSEDOWN, new Function(){
+ public void f(Element e) {
+ $(e).css(CSS.COLOR.with(RGBColor.YELLOW));
+ }
+ });
+
+ $("#div2", e).addClass("myClass2");
+
+ $("#div2", e).click();
+
+ assertEquals("yellow", $("#div2", e).css(CSS.COLOR));
+
+ $("#div2", e).css(CSS.COLOR.with(RGBColor.BLACK));
+
+ $("#div2", e).trigger(Event.ONMOUSEDOWN);
+ assertEquals("yellow", $("#div2", e).css(CSS.COLOR));
+
+
+
+ }
public void testNamedBinding() {