Author: andrei_exadel
Date: 2009-02-20 07:45:44 -0500 (Fri, 20 Feb 2009)
New Revision: 12700
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java
Log:
RF-6093
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java 2009-02-20
12:31:06 UTC (rev 12699)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java 2009-02-20
12:45:44 UTC (rev 12700)
@@ -12,6 +12,8 @@
*/
public class ColumnGroupBean {
+ boolean rendered = true;
+
List<String> rows = new ArrayList<String>();
public ColumnGroupBean() {
@@ -19,6 +21,15 @@
rows.add("Text" + i);
}
}
+
+ public void reset() {
+ rendered = true;
+ }
+
+ public void prepareRenderedTest() {
+ reset();
+ rendered = false;
+ }
public List<String> getRows() {
return rows;
@@ -28,6 +39,8 @@
this.rows = rows;
}
+ public boolean isRendered() {
+ return rendered;
+ }
-
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml 2009-02-20
12:31:06 UTC (rev 12699)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml 2009-02-20
12:45:44 UTC (rev 12700)
@@ -10,31 +10,41 @@
<ui:define name="component">
<rich:dataTable id="table" value="#{columnGroupBean.rows}"
var="row">
<f:facet name="header">
- <rich:columnGroup columnClasses="columnClass"
+ <rich:columnGroup rendered="#{columnGroupBean.rendered}"
+ columnClasses="columnClass"
rowClasses="rowClass"
style="color: green"
title="title">
- <rich:column colspan="2">
- <h:outputText value="Header1"></h:outputText>
+ <rich:column rowspan="2">
+ <h:outputText value="Header"></h:outputText>
</rich:column>
- <rich:column colspan="2">
- <h:outputText value="Header2"></h:outputText>
+ <rich:column >
+ <h:outputText value="Header"></h:outputText>
</rich:column>
+ <rich:column>
+ <h:outputText value="Header"></h:outputText>
+ </rich:column>
+ <rich:column rowspan="2">
+ <h:outputText value="Header"></h:outputText>
+ </rich:column>
+ <rich:column colspan="2" breakBefore="true">
+ <h:outputText value="Header"></h:outputText>
+ </rich:column>
</rich:columnGroup>
</f:facet>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- </rich:dataTable>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ </rich:dataTable>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java 2009-02-20
12:31:06 UTC (rev 12699)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java 2009-02-20
12:45:44 UTC (rev 12700)
@@ -14,9 +14,25 @@
*/
public class ColumnGroupTest extends SeleniumTestBase {
+ static final String RESET_METHOD = "#{columnGroupBean.reset}";
+ static final String RESET_METHOD_FOR_RENDERED_TEST =
"#{columnGroupBean.prepareRenderedTest}";
+
+
@Test
+ public void testRenderedAttribute(Template template) {
+ renderPage(template, RESET_METHOD_FOR_RENDERED_TEST);
+ String tableId = getParentId() + "table";
+
+ int headerContentCount =
selenium.getXpathCount("//table[(a)id='"+tableId+"']/thead/*").intValue();
+
+ if (headerContentCount != 0) {
+ Assert.fail("Rendered attribute does not work. Table header should not be output
to client.");
+ }
+ }
+
+ @Test
public void testStylesAndClasses(Template template) {
- renderPage(template, null);
+ renderPage(template, RESET_METHOD);
String tableId = getParentId() + "table";
// Check rowClass attribute
@@ -43,28 +59,18 @@
@Test
public void testOutput(Template template) {
- renderPage(template, null);
+ renderPage(template, RESET_METHOD);
String tableId = getParentId() + "table";
- // Check colgroup tag
- int colGroupTagCount = selenium.getXpathCount(getTableXpath(tableId) +
"/colgroup").intValue();
- Assert.assertEquals(colGroupTagCount, 1, "Colgroup tag was not output to
client");
+ // Check breakBefore attribute
+ int headerRowsCount =
selenium.getXpathCount("//table[(a)id='"+tableId+"']/thead/tr").intValue();
+ int firstRowColsCount =
selenium.getXpathCount("//table[(a)id='"+tableId+"']/thead/tr[1]/th").intValue();
+ int secondRowColsCount =
selenium.getXpathCount("//table[(a)id='"+tableId+"']/thead/tr[2]/th").intValue();
- String colGroupSpan = selenium.getAttribute(getTableXpath(tableId) +
"/colgroup/@span");
- Assert.assertEquals(colGroupSpan, "4", "Colgroup span is incorrect.
Should be 4. But was " + colGroupSpan);
-
- // Check grouped columns rendering
- int rows = selenium.getXpathCount(getTableXpath(tableId) +
"/thead/tr").intValue();
- Assert.assertEquals(rows, 1, "Table header should have one row");
-
- int cols = selenium.getXpathCount(getTableXpath(tableId) +
"/thead/tr/th").intValue();
- Assert.assertEquals(cols, 2, "Table header should have two columns");
-
- String colspan = selenium.getAttribute(getTableXpath(tableId) +
"/thead/tr/th/@colspan");
- Assert.assertEquals(colspan, "2", "Table header column should have
colspan=2 attribute ");
- AssertTextEquals(getTableXpath(tableId) + "/thead/tr/th[1]",
"Header1", "Columns header was not rendered as expected");
-
+ if (headerRowsCount != 2 || firstRowColsCount != 4 || secondRowColsCount != 1) {
+ Assert.fail("ColumnGroup component works unexpectly. Table header should have two
rows. The first row should have 4 columns. The second - 1 column.");
+ }
}
String getTableXpath(String clientId) {
Show replies by date