Revision: 7865
Author: [email protected]
Date: Fri Apr  2 11:04:34 2010
Log: Adds a couple of table related tests, one of which exposed the table
problems with DomCursor. More to follow as its re-introduced.

Review at http://gwt-code-reviews.appspot.com/306801

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=7865

Modified:
 /trunk/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java
 /trunk/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml
 /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java

=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java Thu Oct 29 21:43:40 2009 +++ /trunk/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java Fri Apr 2 11:04:34 2010
@@ -18,7 +18,10 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.SpanElement;
-import com.google.gwt.dom.client.StyleInjector;
+import com.google.gwt.dom.client.TableCellElement;
+import com.google.gwt.dom.client.TableColElement;
+import com.google.gwt.dom.client.TableRowElement;
+import com.google.gwt.dom.client.TableSectionElement;
 import com.google.gwt.resources.client.ClientBundle;
 import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.uibinder.client.UiBinder;
@@ -51,19 +54,18 @@
   private static final Resources res = GWT.create(Resources.class);
   private static final Binder binder = GWT.create(Binder.class);

-  private static boolean stylesInjected = false;
-
   @UiField SpanElement nameSpan;
   @UiField Element tmElement;
   @UiField Element root;
+  @UiField TableColElement narrowColumn;
+  @UiField TableRowElement tr;
+  @UiField TableCellElement th1;
+  @UiField TableCellElement th2;
+  @UiField TableSectionElement tbody;
+  @UiField TableCellElement th4;

   public DomBasedUi(String yourNameHere) {
-    // Inject only once.
-    if (!stylesInjected) {
-      StyleInjector.injectStylesheet(res.style().getText());
-      stylesInjected = true;
-    }
-
+    res.style().ensureInjected();
     binder.createAndBindUi(this);
     nameSpan.setInnerText(yourNameHere);
   }
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml Thu Oct 29 21:43:40 2009 +++ /trunk/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml Fri Apr 2 11:04:34 2010
@@ -25,5 +25,21 @@
       that you don't want the translators to mess with. You can protect
       these with <span style="font-weight:bold"
ui:ph="boldSpan">placeholders</span><ui:ph name="tm"><sup ui:field="tmElement">TM</sup></ui:ph>.</ui:msg></p>
+  <table>
+    <col ui:field='narrowColumn' width='0%'></col>
+    <col width='100%'></col>
+    <tr ui:field='tr'>
+      <th ui:field='th1'>Tables with col elements</th>
+      <th ui:field='th2' align='left'>are</th>
+      <th ui:field='th3' align='left'>tricky</th>
+    </tr>
+  </table>
+  <table>
+    <tbody ui:field='tbody'>
+    <tr ui:field='tr2'>
+      <th ui:field='th4'>Tables with tbody elements too</th>
+    </tr>
+    </tbody>
+  </table>
   </div>
 </ui:UiBinder>
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java Fri Apr 2 07:37:08 2010 +++ /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java Fri Apr 2 11:04:34 2010
@@ -69,6 +69,18 @@
     RootPanel.get().clear();
     super.gwtTearDown();
   }
+
+  public void testTableWithColumns() {
+    assertEquals("col", domUi.narrowColumn.getTagName().toLowerCase());
+    assertEquals("tr", domUi.tr.getTagName().toLowerCase());
+    assertEquals("th", domUi.th1.getTagName().toLowerCase());
+    assertEquals("th", domUi.th2.getTagName().toLowerCase());
+  }
+
+  public void testTableWithExplicitTbody() {
+    assertEquals("tbody", domUi.tbody.getTagName().toLowerCase());
+    assertEquals("th", domUi.th4.getTagName().toLowerCase());
+  }

   public void testAutoboxingFieldRef() {
     FakeBundle fakeBundle = new FakeBundle();

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to