[richfaces-svn-commits] JBoss Rich Faces SVN: r420 - trunk/richfaces/dataTable/src/test/java/org/richfaces/component.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Sat Apr 14 07:59:14 EDT 2007
Author: F.antonov
Date: 2007-04-14 07:59:14 -0400 (Sat, 14 Apr 2007)
New Revision: 420
Added:
trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataDefinitionListComponentsTest.java
trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataListComponentsTest.java
trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataOrderedListComponentsTest.java
Removed:
trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java
Log:
DataTable components test cases development.
Deleted: trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java
===================================================================
--- trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java 2007-04-14 01:22:47 UTC (rev 419)
+++ trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java 2007-04-14 11:59:14 UTC (rev 420)
@@ -1,123 +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 java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlOutputText;
-import javax.faces.model.ListDataModel;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.html.HtmlColumnGroup;
-import org.richfaces.component.html.HtmlColumn;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-/**
- * Unit test for DataList component.
- */
-public class AbstractListComponentsTest extends AbstractAjax4JsfTestCase {
-
- private UIDataList dataList;
-
- /**
- * Create the test case
- *
- * @param testName
- * name of the test case
- */
- public AbstractListComponentsTest(String testName) {
- super(testName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
-
- dataList = (UIDataList) application
- .createComponent("org.richfaces.DataList");
- dataList.setId("dataList");
-
- List list = new ArrayList();
- for (int i = 1; i <= 10; i++) {
- list.add(new Date((long) Math.random()));
- }
- dataList.setValue(list);
-
- facesContext.getViewRoot().getChildren().add(dataList);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- dataList = null;
- }
-
- /**
- * Test DataList component rendering.
- *
- * @throws Exception
- */
- public void testRenderDataList() throws Exception {
-
- HtmlPage page = renderView();
- assertNotNull(page);
- // System.out.println(page.asXml());
-
- // TYPE=disc|circle|square
- dataList.getAttributes().put("type", "circle");
-
- HtmlElement ul = page.getHtmlElementById(dataList
- .getClientId(facesContext));
- assertNotNull(ul);
- assertEquals("ul", ul.getNodeName());
- String classAttr = ul.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-list rich-datalist"));
-
- List lis = ul.getHtmlElementsByTagName("li");
- assertTrue(lis.size() > 0);
- assertEquals(lis.size(), 10);
- HtmlElement li = (HtmlElement) lis.get(0);
- assertNotNull(li);
- classAttr = li.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-list-item rich-list-item"));
-
- }
-
-}
Copied: trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataDefinitionListComponentsTest.java (from rev 419, trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java)
===================================================================
--- trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataDefinitionListComponentsTest.java (rev 0)
+++ trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataDefinitionListComponentsTest.java 2007-04-14 11:59:14 UTC (rev 420)
@@ -0,0 +1,215 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlOutputLink;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.ValueBinding;
+import javax.faces.model.ListDataModel;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlColumnGroup;
+import org.richfaces.component.html.HtmlColumn;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Unit test for DataDefinitionList component.
+ */
+public class DataDefinitionListComponentsTest extends AbstractAjax4JsfTestCase {
+
+ private UIDataList dataList;
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+ public DataDefinitionListComponentsTest(String testName) {
+ super(testName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ dataList = (UIDataList) application
+ .createComponent("org.richfaces.DataDefinitionList");
+ dataList.setId("dataDefinitionList");
+
+ List list = new ArrayList();
+ for (int i = 1; i <= 5; i++) {
+ list.add(new Date((long) Math.random()));
+ }
+ dataList.setValue(new ListDataModel(list));
+
+ UIOutput element1 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ element1.setValueBinding("value", new ValueBinding() {
+ public Class getType(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+
+ public Object getValue(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return Long.toString(((Date) dataList.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ }
+ });
+ dataList.getChildren().add(element1);
+
+ UIOutput element2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputLink.class.getName(),
+ null, null, null);
+ element2.setValueBinding("value", new ValueBinding() {
+ public Class getType(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+
+ public Object getValue(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return Long.toString(((Date) dataList.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ }
+ });
+ dataList.getChildren().add(element2);
+
+ facesContext.getViewRoot().getChildren().add(dataList);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ dataList = null;
+ }
+
+ /**
+ * Test DataDefinitionList component rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderDataDefinitionList() throws Exception {
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ // System.out.println(page.asXml());
+
+ HtmlElement dl = page.getHtmlElementById(dataList
+ .getClientId(facesContext));
+ assertNotNull(dl);
+ assertEquals("dl", dl.getNodeName());
+ String classAttr = dl.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-deflist rich-deflist"));
+
+ List dds = dl.getHtmlElementsByTagName("dd");
+ assertTrue(dds.size() > 0);
+ assertEquals(dds.size(), 5);
+ HtmlElement dd = (HtmlElement) dds.get(0);
+ assertNotNull(dd);
+ classAttr = dd.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-definition rich-definition"));
+ }
+
+ /**
+ * Test DataDefinitionList component facet rendering.
+ *
+ * @throws Exception
+ */
+ public void testDataDefinitionListFacet() throws Exception {
+
+ UIOutput facet = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ facet.setValue("Term facet");
+ dataList.getFacets().put("term", facet);
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ // System.out.println(page.asXml());
+
+ HtmlElement dl = page.getHtmlElementById(dataList
+ .getClientId(facesContext));
+ assertNotNull(dl);
+ assertEquals("dl", dl.getNodeName());
+ String classAttr = dl.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-deflist rich-deflist"));
+
+ List dts = dl.getHtmlElementsByTagName("dt");
+ assertTrue(dts.size() > 0);
+ assertEquals(dts.size(), 5);
+ HtmlElement dt = (HtmlElement) dts.get(0);
+ assertNotNull(dt);
+ classAttr = dt.getAttributeValue("class");
+ assertTrue(classAttr
+ .contains("dr-definition-term rich-definition-term"));
+
+ List dds = dl.getHtmlElementsByTagName("dd");
+ assertTrue(dds.size() > 0);
+ assertEquals(dds.size(), 5);
+ HtmlElement dd = (HtmlElement) dds.get(0);
+ assertNotNull(dd);
+ classAttr = dd.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-definition rich-definition"));
+ }
+}
Copied: trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataListComponentsTest.java (from rev 419, trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java)
===================================================================
--- trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataListComponentsTest.java (rev 0)
+++ trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataListComponentsTest.java 2007-04-14 11:59:14 UTC (rev 420)
@@ -0,0 +1,180 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlOutputLink;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.ValueBinding;
+import javax.faces.model.ListDataModel;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlColumnGroup;
+import org.richfaces.component.html.HtmlColumn;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Unit test for DataList component.
+ */
+public class DataListComponentsTest extends AbstractAjax4JsfTestCase {
+
+ private UIDataList dataList;
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+ public DataListComponentsTest(String testName) {
+ super(testName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ dataList = (UIDataList) application
+ .createComponent("org.richfaces.DataList");
+ dataList.setId("dataList");
+
+ List list = new ArrayList();
+ for (int i = 1; i <= 5; i++) {
+ list.add(new Date((long) Math.random()));
+ }
+ dataList.setValue(new ListDataModel(list));
+
+ UIOutput element1 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ element1.setValueBinding("value", new ValueBinding() {
+ public Class getType(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+
+ public Object getValue(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return Long.toString(((Date) dataList.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ }
+ });
+ dataList.getChildren().add(element1);
+
+ UIOutput element2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputLink.class.getName(),
+ null, null, null);
+ element2.setValueBinding("value", new ValueBinding() {
+ public Class getType(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+
+ public Object getValue(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return Long.toString(((Date) dataList.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ }
+ });
+ dataList.getChildren().add(element2);
+
+ facesContext.getViewRoot().getChildren().add(dataList);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ dataList = null;
+ }
+
+ /**
+ * Test DataList component rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderDataList() throws Exception {
+
+ // TYPE=disc|circle|square
+ dataList.getAttributes().put("type", "circle");
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ // System.out.println(page.asXml());
+
+ HtmlElement ul = page.getHtmlElementById(dataList
+ .getClientId(facesContext));
+ assertNotNull(ul);
+ assertEquals("ul", ul.getNodeName());
+ String classAttr = ul.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-list rich-datalist"));
+ classAttr = ul.getAttributeValue("type");
+ assertTrue(classAttr.contains((String) dataList.getAttributes().get(
+ "type")));
+
+ List lis = ul.getHtmlElementsByTagName("li");
+ assertTrue(lis.size() > 0);
+ assertEquals(lis.size(), 5);
+ HtmlElement li = (HtmlElement) lis.get(0);
+ assertNotNull(li);
+ classAttr = li.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-list-item rich-list-item"));
+ }
+
+}
Copied: trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataOrderedListComponentsTest.java (from rev 419, trunk/richfaces/dataTable/src/test/java/org/richfaces/component/AbstractListComponentsTest.java)
===================================================================
--- trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataOrderedListComponentsTest.java (rev 0)
+++ trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataOrderedListComponentsTest.java 2007-04-14 11:59:14 UTC (rev 420)
@@ -0,0 +1,180 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlOutputLink;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.ValueBinding;
+import javax.faces.model.ListDataModel;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlColumnGroup;
+import org.richfaces.component.html.HtmlColumn;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Unit test for DataOrderedList component.
+ */
+public class DataOrderedListComponentsTest extends AbstractAjax4JsfTestCase {
+
+ private UIDataList dataList;
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+ public DataOrderedListComponentsTest(String testName) {
+ super(testName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ dataList = (UIDataList) application
+ .createComponent("org.richfaces.DataOrderedList");
+ dataList.setId("DataOrderedList");
+
+ List list = new ArrayList();
+ for (int i = 1; i <= 5; i++) {
+ list.add(new Date((long) Math.random()));
+ }
+ dataList.setValue(new ListDataModel(list));
+
+ UIOutput element1 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ element1.setValueBinding("value", new ValueBinding() {
+ public Class getType(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+
+ public Object getValue(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return Long.toString(((Date) dataList.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ }
+ });
+ dataList.getChildren().add(element1);
+
+ UIOutput element2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputLink.class.getName(),
+ null, null, null);
+ element2.setValueBinding("value", new ValueBinding() {
+ public Class getType(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+
+ public Object getValue(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return Long.toString(((Date) dataList.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(FacesContext context)
+ throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ }
+ });
+ dataList.getChildren().add(element2);
+
+ facesContext.getViewRoot().getChildren().add(dataList);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ dataList = null;
+ }
+
+ /**
+ * Test DataOrderedList component rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderDataOrderedList() throws Exception {
+
+ // TYPE=disc|circle|square
+ dataList.getAttributes().put("type", "circle");
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ // System.out.println(page.asXml());
+
+ HtmlElement ol = page.getHtmlElementById(dataList
+ .getClientId(facesContext));
+ assertNotNull(ol);
+ assertEquals("ol", ol.getNodeName());
+ String classAttr = ol.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-list rich-orderedlist"));
+ classAttr = ol.getAttributeValue("type");
+ assertTrue(classAttr.contains((String) dataList.getAttributes().get(
+ "type")));
+
+ List lis = ol.getHtmlElementsByTagName("li");
+ assertTrue(lis.size() > 0);
+ assertEquals(lis.size(), 5);
+ HtmlElement li = (HtmlElement) lis.get(0);
+ assertNotNull(li);
+ classAttr = li.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-list-item rich-list-item"));
+ }
+
+}
More information about the richfaces-svn-commits
mailing list