Author: F.antonov
Date: 2007-04-02 10:59:34 -0400 (Mon, 02 Apr 2007)
New Revision: 234
Modified:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
Test application update.
Modified:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
---
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-02
14:32:36 UTC (rev 233)
+++
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-02
14:59:34 UTC (rev 234)
@@ -25,13 +25,25 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutputText;
+import org.richfaces.component.html.HtmlMenuItem;
+import org.richfaces.renderkit.html.MenuItemRenderer;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
/**
* Unit test for simple Component.
*/
public class JSFComponentTest
- extends TestCase
+ extends AbstractAjax4JsfTestCase
{
+
+ HtmlMenuItem menuItem;
+
/**
* Create the test case
*
@@ -41,13 +53,44 @@
{
super( testName );
}
+
+ public void setUp() throws Exception {
+ super.setUp();
+ menuItem = new HtmlMenuItem();
+ menuItem.setId("menuItem");
+ menuItem.setRendererType("org.richfaces.MenuItemRenderer");
+ facesContext.getViewRoot().getChildren().add(menuItem);
+ renderKit.addRenderer(menuItem.COMPONENT_FAMILY,
"org.richfaces.MenuItemRenderer", new MenuItemRenderer());
+ }
+ public void tearDown() throws Exception {
+ super.tearDown();
+ menuItem = null;
+ }
/**
* Rigourous Test :-)
*/
- public void testComponent()
+ public void testRender() throws Exception
{
- assertTrue( true );
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById("menuItem");
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
}
+
+ public void testRenderHeader() throws Exception
+ {
+ menuItem = new HtmlMenuItem();
+ menuItem.setId("menuItem");
+ UIComponent text = createComponent(HtmlOutputText.COMPONENT_TYPE,
HtmlOutputText.class.getName(), null, null , null);
+ menuItem.getFacets().put("iconDisabled", text);
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement span = page.getHtmlElementById("menuItem:icon");
+ assertNotNull(span);
+ }
}
Show replies by date