[richfaces-svn-commits] JBoss Rich Faces SVN: r2798 - in trunk/ui/core/src/test/java/org/ajax4jsf: renderkit and 1 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Thu Sep 6 11:23:58 EDT 2007
Author: sergeyhalipov
Date: 2007-09-06 11:23:58 -0400 (Thu, 06 Sep 2007)
New Revision: 2798
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java
Log:
JUnit test for AjaxStatusRenderer class (not finished).
Added: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java 2007-09-06 15:23:58 UTC (rev 2798)
@@ -0,0 +1,105 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.renderkit.html;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIAjaxStatus;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxStatusRendererTest extends AbstractAjax4JsfTestCase {
+ private UIForm form = null;
+ private UIAjaxStatus status1 = null;
+ private UIAjaxStatus status2 = null;
+
+ public AjaxStatusRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent("org.ajax4jsf.AjaxStatus", "org.ajax4jsf.component.html.HtmlAjaxStatus");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ status1 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
+ status1.setId("status1");
+ status1.setStartStyle("color: red;");
+ status1.setStartStyleClass("A B C D");
+ status1.setStopStyle("color: green;");
+ status1.setStopStyleClass("X Y Z");
+ status1.setStartText("startText");
+ status1.setStopText("stopText");
+ status1.getAttributes().put("layout", "block");
+
+ status2 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
+ status2.setId("status2");
+ status2.setStartStyle("color: red;");
+ status2.setStartStyleClass("A B C D");
+ status2.setStopStyle("color: green;");
+ status2.setStopStyleClass("X Y Z");
+ status2.getAttributes().put("layout", "inline");
+
+ UIOutput startOutput = new UIOutput();
+ startOutput.setValue("startOutput");
+ status2.getFacets().put("start", startOutput);
+
+ UIOutput stopOutput = new UIOutput();
+ stopOutput.setValue("stopOutput");
+ status2.getFacets().put("stop", startOutput);
+
+ form.getChildren().add(status1);
+ form.getChildren().add(status2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ status1 = null;
+ status2 = null;
+ form = null;
+ }
+
+ /**
+ * Test rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement div = page.getHtmlElementById(status1.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ }
+
+}
More information about the richfaces-svn-commits
mailing list