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: tstanis@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7865 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java b/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java
index b3cd75c..ffa6ad8 100644
--- a/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java
+++ b/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.java
@@ -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);
}
diff --git a/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml b/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml
index 9b42336..2377b41 100644
--- a/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml
+++ b/user/test/com/google/gwt/uibinder/test/client/DomBasedUi.ui.xml
@@ -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>
diff --git a/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java b/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
index d519e4b..fed497f 100644
--- a/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
+++ b/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
@@ -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();