aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core/src/test/java
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2014-12-21 12:20:01 +0100
committerManolo Carrasco <manolo@apache.org>2014-12-21 12:20:01 +0100
commit38513d2716258a80605938ea165d4664bf03966b (patch)
treecd9ef9fe04708c5c2fefd9ee64b93efdd7ea5949 /gwtquery-core/src/test/java
parenta8511be680e954b370123bd4710dad29e220348d (diff)
downloadgwtquery-38513d2716258a80605938ea165d4664bf03966b.tar.gz
gwtquery-38513d2716258a80605938ea165d4664bf03966b.zip
re-factor SpecialEffects in order to make easier new specials.
- Implementing specials focusin focusout. Fixes #11
Diffstat (limited to 'gwtquery-core/src/test/java')
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java
index 6ec17595..08777f32 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTestGwt.java
@@ -43,7 +43,6 @@ import com.google.gwt.query.client.plugins.Events;
import com.google.gwt.query.client.plugins.events.EventsListener;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
@@ -456,6 +455,28 @@ public class GQueryEventsTestGwt extends GWTTestCase {
assertEquals("", $("p", e).css("border", false));
}
+ @DoNotRunWith({Platform.HtmlUnitLayout})
+ public void testSpecialFocusInOut() {
+ $(e).html("<p>Content</p>");
+ $("p", e).on(EventsListener.FOCUSIN, new Function() {
+ public void f(Element elem) {
+ GQuery.console.log("focus");
+ $(elem).css("background-color", "red");
+ }
+ });
+ $("p", e).focus();
+ assertEquals("red", $("p", e).css("background-color", false));
+
+ // blur
+ $("p", e).on(EventsListener.FOCUSOUT, new Function() {
+ public void f(Element elem) {
+ $(elem).css("background-color", "white");
+ }
+ });
+ $("p", e).blur();
+ assertEquals("white", $("p", e).css("background-color", false));
+ }
+
public void testLazyMethods() {
$(e).css(CSS.COLOR.with(RGBColor.WHITE));
assertEquals("white", $(e).css("color", false));