Author: andrei_exadel
Date: 2008-11-21 11:20:47 -0500 (Fri, 21 Nov 2008)
New Revision: 11293
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
Log:
Panel Test
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-11-21
16:02:54 UTC (rev 11292)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-11-21
16:20:47 UTC (rev 11293)
@@ -101,6 +101,7 @@
list.add(new ComponentItem("<rich:dropSupport>",
"dnd/dndTest.xhtml"));
list.add(new ComponentItem("<rich:effect>",
"effect/effectTest.xhtml"));
list.add(new ComponentItem("<rich:graphValidator>",
"graphValidator/graphValidatorTest.xhtml"));
+ list.add(new ComponentItem("<rich:panel>",
"panel/panelTest.xhtml"));
sortList();
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml 2008-11-21
16:20:47 UTC (rev 11293)
@@ -0,0 +1,17 @@
+<!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.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:panel id="componentId"
+ rendered="#{autoTestBean.rendered}"
+ >
+ </rich:panel>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml 2008-11-21
16:20:47 UTC (rev 11293)
@@ -0,0 +1,30 @@
+<!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">
+ <h:form id="_controls">
+ </h:form>
+
+
+ <h:form id="_form">
+ <rich:panel id="panel" style="color: green; font-weight: bold"
styleClass="myClass"
+ bodyClass="bodyClass"
+ headerClass="headerClass"
+ >
+ <f:facet name="header">
+ <h:outputText id="header"
value="Header"></h:outputText>
+ </f:facet>
+ <h:outputText id="content" value="Panel
Content"></h:outputText>
+ </rich:panel>
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java 2008-11-21
16:20:47 UTC (rev 11293)
@@ -0,0 +1,105 @@
+/**
+ *
+ */
+package org.richfaces.testng;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class PanelTest extends SeleniumTestBase {
+
+ String panelId;
+
+ String panelBodyId;
+
+ String panelHeaderId;
+
+ static final String FORM_ID = "_form:";
+ static final String PANEL_ID = "panel";
+
+
+ static final String [] panelClasses = new String [] {
+ "dr-pnl",
+ "rich-panel",
+ "myClass"
+ };
+
+ static final Map<String, String> styles = new HashMap<String, String>();
+ static {
+ styles.put("color", "green");
+ styles.put("font-weight", "bold");
+ }
+
+ private void initIds(String parentId) {
+ panelId = parentId + FORM_ID + PANEL_ID;
+ panelBodyId = panelId + "_body";
+ panelHeaderId = panelId + "_header";
+ }
+
+ @Test
+ public void testOutputToClient(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ AssertPresent(panelId, "Panel was not output to client");
+ AssertPresent(panelBodyId, "Panel was not output to client");
+ }
+
+ @Test
+ public void testHTMLAndStyles(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ assertClassNames(panelId, panelClasses, "Panel CSS classes was not rendered to
client", true);
+ assertStyleAttributes(panelId, styles);
+
+ assertClassNames(panelBodyId, new String [] {"bodyClass"}, "Body panel
css classes was not rendered to client", true);
+
+ }
+
+ @Test
+ public void testContentAndFacets(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ AssertPresent(panelBodyId);
+ AssertPresent(panelHeaderId);
+
+ AssertTextEquals(panelHeaderId, "Header", "Header facet was not rendered
to client");
+ AssertTextEquals(panelBodyId, "Panel Content", "Panel does not render
children components");
+
+ }
+
+ @Test
+ public void testRendered(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+
+ tester.testRendered();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/panel/panelTest.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/panel/panelAutoTest.xhtml";
+ }
+
+}