From bb080468879ff482c7af4286e5a91b9ca0f54af2 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Wed, 12 May 2010 15:57:13 +0000 Subject: [PATCH] Fixes Issue_18 --- .../java/com/google/gwt/query/client/GQuery.java | 2 +- .../com/google/gwt/query/client/LazyGQuery.java | 4 +++- .../gwt/query/client/GQueryEventsTest.java | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 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 4e48334f..373ca2d7 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 @@ -342,7 +342,7 @@ public class GQuery implements Lazy { * Return a lazy version of the GQuery interface. Lazy function calls are * simply queued up and not executed immediately. */ - public static LazyGQuery lazy() { + public static LazyGQuery lazy() { return GQuery.$().createLazy(); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java index 5e95bfc3..43129fcf 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java @@ -2,6 +2,7 @@ package com.google.gwt.query.client; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Node; +import com.google.gwt.query.client.css.CssProperty; /** * Created by IntelliJ IDEA. User: ray Date: May 2, 2009 Time: 10:48:07 PM To @@ -200,7 +201,8 @@ public interface LazyGQuery extends LazyBase { * inferred from the CSS property type * @return */ - // LazyGQuery css(CssProperty property, T value); + > LazyGQuery css(P cssProperty, S value); + /** * Set a key/value object as style properties to all matched elements. This 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 85285a67..a5b2f366 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 @@ -24,6 +24,7 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.junit.DoNotRunWith; import com.google.gwt.junit.Platform; import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.query.client.css.CSS; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HTML; @@ -48,6 +49,8 @@ public class GQueryEventsTest extends GWTTestCase { RootPanel.get().add(testPanel); e = testPanel.getElement(); e.setId("evnt-tst"); + + CSS.init(); } else { e.setInnerHTML(""); } @@ -174,6 +177,19 @@ public class GQueryEventsTest extends GWTTestCase { $("p", e).dblclick(); assertEquals("yellow", $("p", e).css("color")); } + + public void testLazyMethods() { + $(e).css("color", "white"); + assertEquals("white", $(e).css("color")); + + $(e).one(Event.ONCLICK, null, lazy().css("color", "red").done()); + $(e).click(); + assertEquals("red", $(e).css("color")); + + $(e).click(lazy().css(CSS.COLOR, CSS.BLACK).done()); + $(e).click(); + assertEquals("black", $(e).css("color")); + } public void testWidgetEvents() { final Button b = new Button("click-me"); -- 2.39.5