]> source.dussan.org Git - gwtquery.git/commitdiff
Fixes Issue_18
authorManolo Carrasco <manolo@apache.org>
Wed, 12 May 2010 15:57:13 +0000 (15:57 +0000)
committerManolo Carrasco <manolo@apache.org>
Wed, 12 May 2010 15:57:13 +0000 (15:57 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java

index 4e48334f02ba3c3aef21d0daeb456be1d66d7c06..373ca2d7896195f0ee5b7a9dc87c3be7e6c36630 100644 (file)
@@ -342,7 +342,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    * Return a lazy version of the GQuery interface. Lazy function calls are\r
    * simply queued up and not executed immediately.\r
    */\r
-  public static LazyGQuery lazy() {\r
+  public static LazyGQuery<?> lazy() {\r
     return GQuery.$().createLazy();\r
   }\r
 \r
index 5e95bfc30ecf5d8c5c1cc159ff05c337236c1802..43129fcff3aeb1131106e7eabddbd01055b7668c 100644 (file)
@@ -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
index 85285a67bf2d1938ffec7ae4524931459329a01c..a5b2f366ac23a0b87c6552909576fc3fe0e24c55 100644 (file)
@@ -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");