Reviewers: tstanis,

Description:
Adds a couple of table related tests, one of which exposed the table
problems with DomCursor. More to follow as its re-introduced.

Review by: [email protected]

Please review this at http://gwt-code-reviews.appspot.com/306801/show

Affected files:
  M user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java
  M user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml
  M user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java


Index: user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java
===================================================================
--- user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java (revision 7858) +++ user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java (working copy)
@@ -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);
   }
Index: user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml
===================================================================
--- user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml (revision 7858) +++ user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml (working copy)
@@ -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>
Index: user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
===================================================================
--- user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java (revision 7858) +++ user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java (working copy)
@@ -70,6 +70,18 @@
     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