From 460ef6ed3197429b5f66081c43a8d748a2d2feb7 Mon Sep 17 00:00:00 2001 From: Julien Dramaix Date: Sun, 10 Apr 2011 08:17:32 +0000 Subject: oopps testLiveWithMultipleEvent() should not be committed --- .../google/gwt/query/client/GQueryEventsTest.java | 48 +++++++++++----------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'gwtquery-core/src/test') 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 af3f2465..876ee78d 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 @@ -388,28 +388,7 @@ public void testLiveWithMultipleFunction() { } -public void testLiveWithMultipleEvent() { - - $(e).html("
Content 1 blop
"); - - $(".clickable", e).live(Event.ONCLICK | Event.ONMOUSEMOVE, 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)); - - //reset - $("#div1", e).css(CSS.COLOR.with(RGBColor.BLACK)); - - - -} + public void testNamedBinding() { @@ -523,7 +502,30 @@ public void testLiveWithMultipleEvent() { assertEquals($("#test").attr("tabIndex"), "2"); } - + public void testUnbindMultipleEvents() { + String content = "

content

"; + $(e).html(content); + $(document).bind(Event.ONMOUSEMOVE, null, new Function() { + public void f(Element e){ + $("p").css(CSS.COLOR.with(RGBColor.RED)); + } + }); + $(document).bind(Event.ONMOUSEUP, null, new Function(){ + public void f(Element e){ + $("p").css(CSS.COLOR.with(RGBColor.YELLOW)); + } + }); + $(document).trigger(Event.ONMOUSEMOVE); + assertEquals("red", $("p").css("color")); + $(document).trigger(Event.ONMOUSEUP); + assertEquals("yellow", $("p").css("color")); + $("p").css(CSS.COLOR.with(RGBColor.BLACK)); + $(document).unbind(Event.ONMOUSEUP|Event.ONMOUSEMOVE); + $(document).trigger(Event.ONMOUSEMOVE); + assertEquals("black", $("p").css("color")); + $(document).trigger(Event.ONMOUSEUP); + assertEquals("black", $("p").css("color")); + } public void testWidgetEvents() { final Button b = new Button("click-me"); -- cgit v1.2.3