JBoss Rich Faces SVN: r278 - trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-05 05:23:20 -0400 (Thu, 05 Apr 2007)
New Revision: 278
Modified:
trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
Log:
test updated
Modified: trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2007-04-05 09:21:38 UTC (rev 277)
+++ trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2007-04-05 09:23:20 UTC (rev 278)
@@ -40,7 +40,7 @@
* Unit test for SimpleTogglePanel component.
*/
public class SimpleTogglePanelComponentTest extends AbstractAjax4JsfTestCase {
-
+
private static Set javaScripts = new HashSet();
static {
@@ -90,6 +90,15 @@
}
/**
+ * Test component default values
+ *
+ * @throws Exception
+ */
+ public void testDefaultValues() throws Exception {
+ assertEquals("100%", ui.getWidth());
+ assertEquals(true, ui.isOpened());
+ }
+ /**
* Test component rendering
*
* @throws Exception
19 years
JBoss Rich Faces SVN: r277 - trunk/richfaces/separator/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-05 05:21:38 -0400 (Thu, 05 Apr 2007)
New Revision: 277
Modified:
trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
Log:
test updated
Modified: trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
===================================================================
--- trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2007-04-05 09:20:44 UTC (rev 276)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2007-04-05 09:21:38 UTC (rev 277)
@@ -93,6 +93,19 @@
}
/**
+ * Test component default values
+ *
+ * @throws Exception
+ */
+ public void testDefaultValues() throws Exception {
+ assertEquals("100%", ui.getWidth());
+ assertEquals("6px", ui.getHeight());
+ assertEquals("beveled", ui.getLineType());
+ assertEquals("beveled", ui.getLineType());
+ assertEquals("left", ui.getAlign());
+ }
+
+ /**
* Test component rendering
*
* @throws Exception
19 years
JBoss Rich Faces SVN: r276 - trunk/richfaces/datascroller/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-05 05:20:44 -0400 (Thu, 05 Apr 2007)
New Revision: 276
Modified:
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
Log:
test updated
Modified: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-04 19:31:52 UTC (rev 275)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-05 09:20:44 UTC (rev 276)
@@ -95,6 +95,20 @@
}
/**
+ * Test component default values
+ *
+ * @throws Exception
+ */
+ public void testDefaultValues() throws Exception {
+ assertEquals(0, scroller.getFastStep());
+ assertEquals(10, scroller.getMaxPages());
+ assertEquals(true, scroller.isRenderIfSinglePage());
+ assertEquals(true, scroller.isIgnoreDupResponses());
+ assertEquals(true, scroller.isAjaxSingle());
+ assertEquals(true, scroller.isRenderCurrentAsText());
+ }
+
+ /**
* Test component rendering
*
* @throws Exception
19 years
JBoss Rich Faces SVN: r275 - trunk/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-04 15:31:52 -0400 (Wed, 04 Apr 2007)
New Revision: 275
Modified:
trunk/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
Log:
Richfaces.visitTree() utility method added
Modified: trunk/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
--- trunk/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-04-04 15:59:34 UTC (rev 274)
+++ trunk/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-04-04 19:31:52 UTC (rev 275)
@@ -57,4 +57,18 @@
}
return !!elt;
+};
+
+Richfaces.visitTree = function(root, callback) {
+ var node = root;
+ if (!node) {
+ node = document;
+ }
+
+ callback.call(this, node);
+
+ var children = node.childNodes;
+ for (var i = 0; i < children.length; i++ ) {
+ Richfaces.visitTree(children[i], callback);
+ }
};
\ No newline at end of file
19 years
JBoss Rich Faces SVN: r274 - trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-04 11:59:34 -0400 (Wed, 04 Apr 2007)
New Revision: 274
Added:
trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
Removed:
trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
test for SimpleTogglePanel component added
Deleted: trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-04 14:57:38 UTC (rev 273)
+++ trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-04 15:59:34 UTC (rev 274)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - 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.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
Added: trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java (rev 0)
+++ trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2007-04-04 15:59:34 UTC (rev 274)
@@ -0,0 +1,169 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component;
+
+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.HtmlSimpleTogglePanel;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Unit test for SimpleTogglePanel component.
+ */
+public class SimpleTogglePanelComponentTest extends AbstractAjax4JsfTestCase {
+
+ private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("prototype.js");
+ javaScripts.add("org.ajax4jsf.framework.ajax.ImageCacheScript");
+ javaScripts.add("org/ajax4jsf/renderkit/html/scripts/form.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/browser_info.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/simpleTogglePanel.js");
+ }
+
+ private HtmlSimpleTogglePanel ui;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public SimpleTogglePanelComponentTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ ui = (HtmlSimpleTogglePanel)application.createComponent(HtmlSimpleTogglePanel.COMPONENT_TYPE);
+ ui.setId("simpleTogglePanel");
+
+ form.getChildren().add(ui);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ ui = null;
+ form = null;
+ }
+
+ /**
+ * Test component rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement div1 = page.getHtmlElementById(form.getId() + ":" + ui.getId());
+ Assert.assertNotNull(div1);
+ Assert.assertEquals("div", div1.getNodeName());
+
+ String classAttr1 = div1.getAttributeValue("class");
+ Assert.assertTrue(classAttr1.contains("dr-stglpnl"));
+ Assert.assertTrue(classAttr1.contains("rich-stglpanel"));
+
+ HtmlElement div2 = page.getHtmlElementById(form.getId() + ":" + ui.getId() + "_header");
+ Assert.assertNotNull(div2);
+ Assert.assertEquals("div", div2.getNodeName());
+
+ String classAttr2 = div2.getAttributeValue("class");
+ Assert.assertTrue(classAttr2.contains("dr-stglpnl-h"));
+ Assert.assertTrue(classAttr2.contains("rich-stglpanel-header"));
+
+ HtmlElement div3 = page.getHtmlElementById(form.getId() + ":" + ui.getId() + "_switch");
+ Assert.assertNotNull(div3);
+ Assert.assertEquals("div", div3.getNodeName());
+
+ HtmlElement div4 = page.getHtmlElementById(form.getId() + ":" + ui.getId() + "_body");
+ Assert.assertNotNull(div4);
+ Assert.assertEquals("div", div4.getNodeName());
+ }
+
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ Assert.assertEquals(1, links.size());
+ HtmlElement link = (HtmlElement) links.get(0);
+ Assert.assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/simpleTogglePanel.xcss"));
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ }
+}
19 years
JBoss Rich Faces SVN: r273 - in trunk/richfaces/separator/src/test/java/org/richfaces: component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-04 10:57:38 -0400 (Wed, 04 Apr 2007)
New Revision: 273
Added:
trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
trunk/richfaces/separator/src/test/java/org/richfaces/component/html/
trunk/richfaces/separator/src/test/java/org/richfaces/component/html/HtmlSeparatorTest.java
trunk/richfaces/separator/src/test/java/org/richfaces/taglib/
trunk/richfaces/separator/src/test/java/org/richfaces/taglib/SeparatorTagTest.java
Removed:
trunk/richfaces/separator/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
test for separator added
Deleted: trunk/richfaces/separator/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/separator/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-04 14:55:32 UTC (rev 272)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-04 14:57:38 UTC (rev 273)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - 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.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
Added: trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
===================================================================
--- trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java (rev 0)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2007-04-04 14:57:38 UTC (rev 273)
@@ -0,0 +1,115 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component;
+
+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.HtmlSeparator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Unit test for Separator component.
+ */
+public class SeparatorComponentTest extends AbstractAjax4JsfTestCase {
+
+ private HtmlSeparator ui;
+ private UIComponent form;
+ private UIOutput out1;
+ private UIOutput out2;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public SeparatorComponentTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+
+ out1 = (UIOutput)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ out1.setValue("output1");
+ form.getChildren().add(out1);
+
+ ui = (HtmlSeparator)application.createComponent(HtmlSeparator.COMPONENT_TYPE);
+ ui.setId("separator");
+ form.getChildren().add(ui);
+
+ out2 = (UIOutput)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ out2.setValue("output2");
+ form.getChildren().add(out2);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ ui = null;
+ form = null;
+ out1 = null;
+ out2 = null;
+ }
+
+ /**
+ * Test component rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement div1 = page.getHtmlElementById(form.getId() + ":" + ui.getId());
+ Assert.assertNotNull(div1);
+ Assert.assertEquals("div", div1.getNodeName());
+
+ HtmlElement div2 = (HtmlElement)div1.getHtmlElementsByTagName("div").get(0);
+ String classAttr = div2.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("rich-separator"));
+ String styleAttr = div2.getAttributeValue("style");
+ Assert.assertTrue(styleAttr.contains("org.richfaces.renderkit.html.images.BevelSeparatorImage"));
+ }
+}
Added: trunk/richfaces/separator/src/test/java/org/richfaces/component/html/HtmlSeparatorTest.java
===================================================================
--- trunk/richfaces/separator/src/test/java/org/richfaces/component/html/HtmlSeparatorTest.java (rev 0)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/component/html/HtmlSeparatorTest.java 2007-04-04 14:57:38 UTC (rev 273)
@@ -0,0 +1,68 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component.html;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import junit.framework.Assert;
+
+/**
+ * Unit test for HtmlSeparator.
+ */
+public class HtmlSeparatorTest extends AbstractAjax4JsfTestCase {
+
+ /**
+ * Create the test case
+ *
+ * @param name name of the test case
+ */
+ public HtmlSeparatorTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test save/restore state
+ *
+ * @throws Exception
+ */
+ public void testSaveStateFacesContext() throws Exception {
+ HtmlSeparator ui = new HtmlSeparator();
+ ui.setStyleClass("styleClass");
+ Object state = ui.saveState(facesContext);
+ HtmlSeparator newDs = new HtmlSeparator();
+ newDs.restoreState(facesContext, state);
+ Assert.assertEquals("styleClass", newDs.getStyleClass());
+ }
+}
Added: trunk/richfaces/separator/src/test/java/org/richfaces/taglib/SeparatorTagTest.java
===================================================================
--- trunk/richfaces/separator/src/test/java/org/richfaces/taglib/SeparatorTagTest.java (rev 0)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/taglib/SeparatorTagTest.java 2007-04-04 14:57:38 UTC (rev 273)
@@ -0,0 +1,98 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.taglib;
+
+import junit.framework.Assert;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlSeparator;
+
+import javax.faces.webapp.UIComponentTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+
+/**
+ * Test for SeparatorTag
+ */
+public class SeparatorTagTest extends AbstractAjax4JsfTestCase {
+
+ SeparatorTag tag;
+
+ /**
+ * Create the test case
+ *
+ * @param name name of the test case
+ */
+ public SeparatorTagTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ tag = new SeparatorTag();
+ tag.setParent(new UIComponentTag(){
+
+ public String getComponentType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getRendererType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int doStartTag() throws JspException {
+ // TODO Auto-generated method stub
+ return Tag.EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ // TODO Auto-generated method stub
+ return Tag.EVAL_BODY_INCLUDE;
+ }
+
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ tag = null;
+ }
+
+ /**
+ * Test method for {@link org.richfaces.taglib.SeparatorTag#setProperties(javax.faces.component.UIComponent)}.
+ * @throws javax.servlet.jsp.JspException
+ */
+ public void testSetPropertiesUIComponent() throws JspException {
+ HtmlSeparator ui = new HtmlSeparator();
+
+ tag.setStyleClass("styleClass");
+ tag.setProperties(ui);
+ Assert.assertEquals("styleClass", ui.getStyleClass());
+ }
+}
19 years
JBoss Rich Faces SVN: r272 - in trunk/richfaces/suggestionbox/src/test/java/org/richfaces: component/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-04 10:55:32 -0400 (Wed, 04 Apr 2007)
New Revision: 272
Modified:
trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java
trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java
trunk/richfaces/suggestionbox/src/test/java/org/richfaces/taglib/SuggestionBoxTagTest.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-04 14:54:29 UTC (rev 271)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java 2007-04-04 14:55:32 UTC (rev 272)
@@ -66,6 +66,9 @@
super(testName);
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
public void setUp() throws Exception {
super.setUp();
@@ -84,6 +87,9 @@
form.getChildren().add(sb);
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
public void tearDown() throws Exception {
super.tearDown();
sb = null;
Modified: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java 2007-04-04 14:54:29 UTC (rev 271)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java 2007-04-04 14:55:32 UTC (rev 272)
@@ -31,17 +31,23 @@
super(name);
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
public void setUp() throws Exception {
super.setUp();
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
public void tearDown() throws Exception {
super.tearDown();
}
/**
* Test save/restore state
- *
+ *
* @throws Exception
*/
public void testSaveStateFacesContext() throws Exception {
Modified: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/taglib/SuggestionBoxTagTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/taglib/SuggestionBoxTagTest.java 2007-04-04 14:54:29 UTC (rev 271)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/taglib/SuggestionBoxTagTest.java 2007-04-04 14:55:32 UTC (rev 272)
@@ -37,8 +37,8 @@
}
/* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
public void setUp() throws Exception {
super.setUp();
tag = new SuggestionBoxTag();
@@ -68,8 +68,8 @@
}
/* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
public void tearDown() throws Exception {
super.tearDown();
tag = null;
19 years
JBoss Rich Faces SVN: r271 - in trunk/richfaces/datascroller/src/test/java/org/richfaces: component/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-04 10:54:29 -0400 (Wed, 04 Apr 2007)
New Revision: 271
Modified:
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java
trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java
Log:
test updated
Modified: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-04 13:38:43 UTC (rev 270)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-04 14:54:29 UTC (rev 271)
@@ -62,6 +62,9 @@
super(testName);
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
public void setUp() throws Exception {
super.setUp();
@@ -81,6 +84,9 @@
form.getChildren().add(scroller);
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
public void tearDown() throws Exception {
super.tearDown();
scroller = null;
@@ -150,6 +156,5 @@
assertTrue(found);
}
}
-
}
}
Modified: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java 2007-04-04 13:38:43 UTC (rev 270)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java 2007-04-04 14:54:29 UTC (rev 271)
@@ -31,17 +31,23 @@
super(name);
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
public void setUp() throws Exception {
super.setUp();
}
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
public void tearDown() throws Exception {
super.tearDown();
}
/**
* Test save/restore state
- *
+ *
* @throws Exception
*/
public void testSaveStateFacesContext() throws Exception {
Modified: trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java 2007-04-04 13:38:43 UTC (rev 270)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java 2007-04-04 14:54:29 UTC (rev 271)
@@ -29,6 +29,9 @@
import javax.servlet.jsp.tagext.Tag;
+/**
+ * Test for DatascrollerTag
+ */
public class DatascrollerTagTest extends AbstractAjax4JsfTestCase {
DatascrollerTag tag;
@@ -38,8 +41,8 @@
}
/* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
public void setUp() throws Exception {
super.setUp();
tag = new DatascrollerTag();
@@ -69,8 +72,8 @@
}
/* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
public void tearDown() throws Exception {
super.tearDown();
tag = null;
19 years
JBoss Rich Faces SVN: r270 - in trunk/richfaces/datascroller/src/test/java/org/richfaces: component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-04 09:38:43 -0400 (Wed, 04 Apr 2007)
New Revision: 270
Added:
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java
trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/
trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java
Removed:
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
Added: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java (rev 0)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-04 13:38:43 UTC (rev 270)
@@ -0,0 +1,155 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component;
+
+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.HtmlDatascroller;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlForm;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Unit test for Datascroller component.
+ */
+public class DatascrollerComponentTest extends AbstractAjax4JsfTestCase {
+ private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("prototype.js");
+ }
+
+ private HtmlDatascroller scroller;
+ private UIComponent form;
+ private UIData data;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public DatascrollerComponentTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ data = (UIData)application.createComponent(HtmlDataTable.COMPONENT_TYPE);
+ data.setId("data");
+ data.setRows(5);
+ form.getChildren().add(data);
+
+ scroller = (HtmlDatascroller)application.createComponent(HtmlDatascroller.COMPONENT_TYPE);
+ scroller.setId("dataScroller");
+ scroller.setFor(data.getId());
+
+ form.getChildren().add(scroller);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ scroller = null;
+ form = null;
+ data = null;
+ }
+
+ /**
+ * Test component rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement div = page.getHtmlElementById(form.getId() + ":" + scroller.getId());
+ Assert.assertNotNull(div);
+ Assert.assertEquals("div", div.getNodeName());
+
+ String classAttr = div.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-dscr"));
+ Assert.assertTrue(classAttr.contains("rich-datascr"));
+ }
+
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+
+ Assert.assertEquals(1, links.size());
+ HtmlElement link = (HtmlElement) links.get(0);
+ Assert.assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/datascroller.xcss"));
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+
+ }
+}
Deleted: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-04 13:38:01 UTC (rev 269)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-04 13:38:43 UTC (rev 270)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - 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.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
Added: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java (rev 0)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java 2007-04-04 13:38:43 UTC (rev 270)
@@ -0,0 +1,55 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component.html;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * Unit test for HtmlDatascroller.
+ */
+public class HtmlDatascrollerTest extends AbstractAjax4JsfTestCase {
+ public HtmlDatascrollerTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test save/restore state
+ *
+ * @throws Exception
+ */
+ public void testSaveStateFacesContext() throws Exception {
+ HtmlDatascroller ds = new HtmlDatascroller();
+ ds.setStyleClass("styleClass");
+ Object state = ds.saveState(facesContext);
+ HtmlDatascroller newDs = new HtmlDatascroller();
+ newDs.restoreState(facesContext, state);
+ assertEquals("styleClass", newDs.getStyleClass());
+ }
+}
Added: trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java (rev 0)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/DatascrollerTagTest.java 2007-04-04 13:38:43 UTC (rev 270)
@@ -0,0 +1,90 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.taglib;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlDatascroller;
+
+import javax.faces.webapp.UIComponentTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+
+
+public class DatascrollerTagTest extends AbstractAjax4JsfTestCase {
+
+ DatascrollerTag tag;
+
+ public DatascrollerTagTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ tag = new DatascrollerTag();
+ tag.setParent(new UIComponentTag(){
+
+ public String getComponentType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getRendererType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int doStartTag() throws JspException {
+ // TODO Auto-generated method stub
+ return Tag.EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ // TODO Auto-generated method stub
+ return Tag.EVAL_BODY_INCLUDE;
+ }
+
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ tag = null;
+ }
+
+ /**
+ * Test method for {@link org.richfaces.taglib.DatascrollerTag#setProperties(javax.faces.component.UIComponent)}.
+ * @throws JspException
+ */
+ public void testSetPropertiesUIComponent() throws JspException {
+ HtmlDatascroller ds = new HtmlDatascroller();
+
+ tag.setStyleClass("styleClass");
+ tag.setProperties(ds);
+ assertEquals("styleClass", ds.getStyleClass());
+ }
+}
19 years
JBoss Rich Faces SVN: r269 - in trunk/richfaces/suggestionbox/src/test: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-04 09:38:01 -0400 (Wed, 04 Apr 2007)
New Revision: 269
Removed:
trunk/richfaces/suggestionbox/src/test/resources/
Modified:
trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java
trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.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-04 13:24:46 UTC (rev 268)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java 2007-04-04 13:38:01 UTC (rev 269)
@@ -28,11 +28,10 @@
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
import org.richfaces.component.html.HtmlSuggestionBox;
-import org.richfaces.renderkit.html.SuggestionBoxRenderer;
-import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.UIInput;
+import javax.faces.component.html.HtmlForm;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -42,21 +41,21 @@
* Unit test for SuggestionBox component.
*/
public class SuggestionBoxComponentTest extends AbstractAjax4JsfTestCase {
- static Set sbScripts = new HashSet();
+ private static Set javaScripts = new HashSet();
static {
- sbScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
- sbScripts.add("prototype.js");
- sbScripts.add("org.ajax4jsf.framework.resource.SmartPositionScript");
- sbScripts.add("org/richfaces/renderkit/html/scripts/browser_info.js");
- sbScripts.add("org/richfaces/renderkit/html/scripts/scriptaculo.js");
- sbScripts.add("org/richfaces/renderkit/html/scripts/suggestionbox.js");
- sbScripts.add("org/richfaces/renderkit/html/scripts/suggestionbox.js");
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("prototype.js");
+ javaScripts.add("org.ajax4jsf.framework.resource.SmartPositionScript");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/browser_info.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/scriptaculo.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/suggestionbox.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/suggestionbox.js");
}
- HtmlSuggestionBox sb;
- UIComponent form;
- UIComponent input;
+ private HtmlSuggestionBox sb;
+ private UIInput input;
+ private UIForm form;
/**
* Create the test case
@@ -70,19 +69,17 @@
public void setUp() throws Exception {
super.setUp();
- form = createComponent(UIForm.COMPONENT_TYPE, UIForm.class.getName(), null, null, null);
- input = createComponent(HtmlInputText.COMPONENT_TYPE, HtmlInputText.class.getName(), null, null, null);
-
+ form = new HtmlForm();
form.setId("form");
- input.setId("text");
facesContext.getViewRoot().getChildren().add(form);
+ input = new UIInput();
+ input.setId("text");
form.getChildren().add(input);
- sb = new HtmlSuggestionBox();
+ sb = (HtmlSuggestionBox)application.createComponent(HtmlSuggestionBox.COMPONENT_TYPE);
sb.setId("suggestionBox");
sb.setFor(input.getId());
- renderKit.addRenderer(HtmlSuggestionBox.COMPONENT_FAMILY, HtmlSuggestionBox.COMPONENT_TYPE, new SuggestionBoxRenderer());
form.getChildren().add(sb);
}
@@ -95,7 +92,7 @@
}
/**
- * Rigourous Test :-)
+ * Test component rendering
*
* @throws Exception
*/
@@ -103,10 +100,15 @@
HtmlPage page = renderView();
Assert.assertNotNull(page);
System.out.println(page.asXml());
+
HtmlElement div = page.getHtmlElementById(form.getId() + ":" + sb.getId());
Assert.assertNotNull(div);
Assert.assertEquals("div", div.getNodeName());
- Assert.assertEquals("dr-sb-common-container rich-sb-common-container", div.getAttributeValue("class"));
+
+ String classAttr = div.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-sb-common-container"));
+ Assert.assertTrue(classAttr.contains("rich-sb-common-container"));
+
HtmlElement table = page.getHtmlElementById(form.getId() + ":" + sb.getId() + ":suggest");
Assert.assertNotNull(table);
Assert.assertEquals("table", table.getNodeName());
@@ -116,7 +118,7 @@
}
/**
- * Rigourous Test :-)
+ * Test style rendering
*
* @throws Exception
*/
@@ -130,7 +132,7 @@
}
/**
- * Rigourous Test :-)
+ * Test script rendering
*
* @throws Exception
*/
@@ -144,7 +146,7 @@
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = sbScripts.iterator(); srcIt.hasNext();) {
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
String src = (String) srcIt.next();
found = srcAttr.contains(src);
Modified: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java 2007-04-04 13:24:46 UTC (rev 268)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/html/HtmlSuggestionBoxTest.java 2007-04-04 13:38:01 UTC (rev 269)
@@ -39,7 +39,12 @@
super.tearDown();
}
- public void testSaveStateFacesContext() {
+ /**
+ * Test save/restore state
+ *
+ * @throws Exception
+ */
+ public void testSaveStateFacesContext() throws Exception {
HtmlSuggestionBox htmlSuggestionBox = new HtmlSuggestionBox();
htmlSuggestionBox.setStyleClass("styleClass");
htmlSuggestionBox.setSelectedClass("selectedClass");
19 years