[richfaces-svn-commits] JBoss Rich Faces SVN: r297 - in trunk/richfaces/suggestionbox/src/test/java/org/richfaces: component and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Apr 6 04:42:02 EDT 2007


Author: A.Skokov
Date: 2007-04-06 04:42:02 -0400 (Fri, 06 Apr 2007)
New Revision: 297

Removed:
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/taglib/
Modified:
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java
Log:
test updated

Modified: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java	2007-04-06 08:41:03 UTC (rev 296)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java	2007-04-06 08:42:02 UTC (rev 297)
@@ -24,10 +24,8 @@
 import com.gargoylesoftware.htmlunit.html.HtmlElement;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlScript;
-import junit.framework.Assert;
 import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
 import org.apache.commons.lang.StringUtils;
-import org.richfaces.component.html.HtmlSuggestionBox;
 
 import javax.faces.component.UIForm;
 import javax.faces.component.UIInput;
@@ -52,7 +50,7 @@
         javaScripts.add("org/richfaces/renderkit/html/scripts/suggestionbox.js");
     }
 
-    private HtmlSuggestionBox sb;
+    private UISuggestionBox sb;
     private UIInput input;
     private UIForm form;
 
@@ -79,7 +77,7 @@
         input.setId("text");
         form.getChildren().add(input);
 
-        sb = (HtmlSuggestionBox)application.createComponent(HtmlSuggestionBox.COMPONENT_TYPE);
+        sb = (UISuggestionBox)application.createComponent("org.richfaces.SuggestionBox");
         sb.setId("suggestionBox");
         sb.setFor(input.getId());
 
@@ -97,43 +95,29 @@
     }
 
     /**
-     * Test component default values
-     *
-     * @throws Exception
-     */
-    public void testDefaultValues() throws Exception {
-        assertEquals("200", sb.getWidth());
-        assertEquals("200", sb.getHeight());
-        assertEquals(true, sb.isAjaxSingle());
-        assertEquals("richfaces_suggestionEntry", sb.getEntryClass());
-        assertEquals("richfaces_suggestionSelectValue", sb.getSelectValueClass());
-        assertEquals("richfaces_suggestionSelectValue", sb.getSelectValueClass());
-        assertEquals("inputvalue", sb.getParam());
-    }
-    /**
      * Test component rendering
      *
      * @throws Exception
      */
     public void testRender() throws Exception {
         HtmlPage page = renderView();
-        Assert.assertNotNull(page);
+        assertNotNull(page);
         System.out.println(page.asXml());
 
-        HtmlElement div = page.getHtmlElementById(form.getId() + ":" + sb.getId());
-        Assert.assertNotNull(div);
-        Assert.assertEquals("div", div.getNodeName());
+        HtmlElement div = page.getHtmlElementById(sb.getClientId(facesContext));
+        assertNotNull(div);
+        assertEquals("div", div.getNodeName());
 
         String classAttr = div.getAttributeValue("class");
-        Assert.assertTrue(classAttr.contains("dr-sb-common-container"));
-        Assert.assertTrue(classAttr.contains("rich-sb-common-container"));
+        assertTrue(classAttr.contains("dr-sb-common-container"));
+        assertTrue(classAttr.contains("rich-sb-common-container"));
 
-        HtmlElement table = page.getHtmlElementById(form.getId() + ":" + sb.getId() + ":suggest");
-        Assert.assertNotNull(table);
-        Assert.assertEquals("table", table.getNodeName());
-        HtmlElement iframe = page.getHtmlElementById(form.getId() + ":" + sb.getId() + "_iframe");
-        Assert.assertNotNull(iframe);
-        Assert.assertEquals("iframe", iframe.getNodeName());
+        HtmlElement table = page.getHtmlElementById(sb.getClientId(facesContext) + ":suggest");
+        assertNotNull(table);
+        assertEquals("table", table.getNodeName());
+        HtmlElement iframe = page.getHtmlElementById(sb.getClientId(facesContext) + "_iframe");
+        assertNotNull(iframe);
+        assertEquals("iframe", iframe.getNodeName());
     }
 
     /**
@@ -143,11 +127,11 @@
      */
     public void testRenderStyle() throws Exception {
         HtmlPage page = renderView();
-        Assert.assertNotNull(page);
+        assertNotNull(page);
         List links = page.getDocumentElement().getHtmlElementsByTagName("link");
-        Assert.assertEquals(1, links.size());
+        assertEquals(1, links.size());
         HtmlElement link = (HtmlElement) links.get(0);
-        Assert.assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/suggestionbox.xcss"));
+        assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/suggestionbox.xcss"));
     }
 
     /**
@@ -157,7 +141,7 @@
      */
     public void testRenderScript() throws Exception {
         HtmlPage page = renderView();
-        Assert.assertNotNull(page);
+        assertNotNull(page);
         List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
         for (Iterator it = scripts.iterator(); it.hasNext();) {
             HtmlScript item = (HtmlScript) it.next();




More information about the richfaces-svn-commits mailing list