diff options
author | Manolo Carrasco <manolo@apache.org> | 2010-05-12 15:57:13 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2010-05-12 15:57:13 +0000 |
commit | bb080468879ff482c7af4286e5a91b9ca0f54af2 (patch) | |
tree | 87ac36e12e381588340f70acff67d04d87bded45 /gwtquery-core/src | |
parent | 3052a62699aad9e012204eaa5a4ed26597ce6d31 (diff) | |
download | gwtquery-bb080468879ff482c7af4286e5a91b9ca0f54af2.tar.gz gwtquery-bb080468879ff482c7af4286e5a91b9ca0f54af2.zip |
Fixes Issue_18
Diffstat (limited to 'gwtquery-core/src')
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<GQuery, LazyGQuery> { * 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<T> extends LazyBase<T> { * inferred from the CSS property type * @return */ - // <T> LazyGQuery<T> css(CssProperty<T> property, T value); + <S, P extends CssProperty<S>> LazyGQuery<T> 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"); |