Author: lfryc(a)redhat.com
Date: 2010-11-16 11:14:39 -0500 (Tue, 16 Nov 2010)
New Revision: 20057
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataGrid/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataGrid.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestSimple.java
Log:
rich:dataGrid - added testNoDataFaces (needs to move checkbox near the component since it
references grid's id in @render) (RFPL-672, RFPL-744)
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataGrid/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataGrid/simple.xhtml 2010-11-16
01:39:10 UTC (rev 20056)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataGrid/simple.xhtml 2010-11-16
16:14:39 UTC (rev 20057)
@@ -37,16 +37,14 @@
<h:outputStylesheet library="css"
name="richDataGrid.css" />
</ui:define>
- <ui:define name="outOfTemplateBefore">
- <br/>
- <h:outputText value="Show data in table: " />
- <h:selectBooleanCheckbox id="noDataCheckbox"
value="#{richDataGridBean.state}">
- <a4j:ajax render="richDataGrid"/>
- </h:selectBooleanCheckbox>
- <br/><br/>
- </ui:define>
-
<ui:define name="component">
+ <h:panelGroup layout="div">
+ <h:outputText value="Show data in table: " />
+ <h:selectBooleanCheckbox id="noDataCheckbox"
value="#{richDataGridBean.state}">
+ <a4j:ajax render="richDataGrid"/>
+ </h:selectBooleanCheckbox>
+ </h:panelGroup>
+
<rich:dataGrid id="richDataGrid"
captionFacet="#{richDataGridBean.attributes['captionFacet'].value}"
columns="#{richDataGridBean.attributes['columns'].value}"
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataGrid.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataGrid.java 2010-11-16
01:39:10 UTC (rev 20056)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataGrid.java 2010-11-16
16:14:39 UTC (rev 20057)
@@ -22,6 +22,7 @@
package org.richfaces.tests.metamer.ftest.model;
import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
+import static
org.jboss.test.selenium.locator.reference.ReferencedLocator.referenceInferred;
import static org.jboss.test.selenium.locator.LocatorFactory.*;
import java.util.Iterator;
@@ -42,6 +43,7 @@
ReferencedLocator<JQueryLocator> rows = ref(root, "> tbody.rf-dg-body
> tr.rf-dg-r");
JQueryLocator rowToNonEmptyElement = jq("td.rf-dg-c:not(:empty)");
JQueryLocator rowToElement = jq("td.rf-dg-c");
+ ReferencedLocator<JQueryLocator> noDataElement = ref(root,
"td.rf-dg-nd-c");
public DataGrid(JQueryLocator root) {
super(root);
@@ -74,4 +76,8 @@
public Iterator<JQueryLocator> iterateElements() {
return rows.getDescendants(rowToNonEmptyElement).iterator();
}
+
+ public boolean isNoData() {
+ return selenium.isElementPresent(noDataElement);
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java 2010-11-16
01:39:10 UTC (rev 20056)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java 2010-11-16
16:14:39 UTC (rev 20057)
@@ -57,6 +57,7 @@
JQueryLocator attributeColumns = pjq("input[id$=columnsInput]");
JQueryLocator attributeElements = pjq("input[id$=elementsInput]");
JQueryLocator attributeFirst = pjq("input[id$=firstInput]");
+ JQueryLocator attributeShowData =
pjq("input:checkbox[id$=noDataCheckbox]");
DataGrid dataGrid = new DataGrid(jq("table.rf-dg[id$=richDataGrid]"));
@@ -159,7 +160,7 @@
expectedRows = ceil((float) expectedElements / columns);
expectedColumns = columns;
-
+
if (first >= ELEMENTS_TOTAL) {
expectedColumns = 0;
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestSimple.java 2010-11-16
01:39:10 UTC (rev 20056)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestSimple.java 2010-11-16
16:14:39 UTC (rev 20057)
@@ -22,6 +22,9 @@
package org.richfaces.tests.metamer.ftest.richDataGrid;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import java.net.URL;
@@ -63,4 +66,13 @@
public void testFirstAttribute() {
verifyGrid();
}
+
+ @Test
+ public void testNoDataFacet() {
+ guardXhr(selenium).click(attributeShowData);
+
+ assertEquals(dataGrid.getColumnCount(), 0);
+ assertEquals(dataGrid.getElementCount(), 0);
+ assertTrue(dataGrid.isNoData());
+ }
}
Show replies by date