Author: andrei_exadel
Date: 2009-02-17 07:05:48 -0500 (Tue, 17 Feb 2009)
New Revision: 12680
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/
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
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
Log:
RF-6094, RF-6092
Added:
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
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java 2009-02-17
12:05:48 UTC (rev 12680)
@@ -0,0 +1,33 @@
+/**
+ *
+ */
+package org.ajax4jsf.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class ColumnGroupBean {
+
+ List<String> rows = new ArrayList<String>();
+
+ public ColumnGroupBean() {
+ for (int i=0; i<2; i++) {
+ rows.add("Text" + i);
+ }
+ }
+
+ public List<String> getRows() {
+ return rows;
+ }
+
+ public void setRows(List<String> rows) {
+ this.rows = rows;
+ }
+
+
+
+}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-17
12:00:22 UTC (rev 12679)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-17
12:05:48 UTC (rev 12680)
@@ -337,6 +337,11 @@
<managed-bean-name>columnsBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.ColumnsBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>columnGroupBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.ColumnGroupBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml 2009-02-17
12:05:48 UTC (rev 12680)
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <rich:dataTable id="table" value="#{columnGroupBean.rows}"
var="row">
+ <f:facet name="header">
+ <rich:columnGroup columnClasses="columnClass"
+ rowClasses="rowClass"
+ style="color: green"
+ title="title">
+ <rich:column colspan="2">
+ <h:outputText value="Header1"></h:outputText>
+ </rich:column>
+ <rich:column colspan="2">
+ <h:outputText value="Header2"></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>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java 2009-02-17
12:05:48 UTC (rev 12680)
@@ -0,0 +1,82 @@
+/**
+ *
+ */
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class ColumnGroupTest extends SeleniumTestBase {
+
+ @Test
+ public void testStylesAndClasses(Template template) {
+ renderPage(template, null);
+ String tableId = getParentId() + "table";
+
+ // Check rowClass attribute
+ String rowClass = selenium.getAttribute(getTableXpath(tableId) +
"/thead/tr/@class");
+ if (!rowClass.contains("rowClass")) {
+ Assert.fail("RowClasses attribute does not work. 'rowClass' css class
should be rendered for header row");
+ }
+
+ // Check style attribute
+ assertStyleAttributeContains(getTableXpath(tableId) + "/thead/tr",
"color: green", "Style attribute does not work ");
+
+ // Check title attribute
+ String title = selenium.getAttribute(getTableXpath(tableId) +
"/thead/tr/@title");
+ Assert.assertEquals(title, "title", "Title was not output to
client");
+
+ // Check columnClasses attribute
+ String columnClass = selenium.getAttribute(getTableXpath(tableId) +
"/thead/tr/th[1]/@class");
+ if (!columnClass.contains("columnClass")) {
+ Assert.fail("ColumnClasses attribute does not work. 'columnClass' css
class should be rendered for header cell");
+ }
+
+ }
+
+
+ @Test
+ public void testOutput(Template template) {
+ renderPage(template, null);
+
+ 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");
+
+ 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");
+
+ }
+
+ String getTableXpath(String clientId) {
+ return "//table[@id='"+clientId+"']";
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/columnGroup/columnGroupTest.xhtml";
+ }
+
+}