[richfaces-svn-commits] JBoss Rich Faces SVN: r2174 - in trunk/ui: tooltip and 3 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Thu Aug 9 10:01:05 EDT 2007
Author: akushunin
Date: 2007-08-09 10:01:04 -0400 (Thu, 09 Aug 2007)
New Revision: 2174
Added:
trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java
Removed:
trunk/ui/tooltip/src/test/java/org/richfaces/component/JSFComponentTest.java
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/ui/tooltip/pom.xml
trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
trunk/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java
Log:
Updated JUnitTests for ToolTip Component
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-08-09 13:50:14 UTC (rev 2173)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-08-09 14:01:04 UTC (rev 2174)
@@ -141,8 +141,8 @@
public abstract void setBoundaryDatesMode(String boundaryDatesMode);
+ //TODO onclick add users onclick
-
// currentDate processing -------------------------------------------------
public Calendar getCalendar() {
Modified: trunk/ui/tooltip/pom.xml
===================================================================
--- trunk/ui/tooltip/pom.xml 2007-08-09 13:50:14 UTC (rev 2173)
+++ trunk/ui/tooltip/pom.xml 2007-08-09 14:01:04 UTC (rev 2174)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
===================================================================
--- trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-08-09 13:50:14 UTC (rev 2173)
+++ trunk/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-08-09 14:01:04 UTC (rev 2174)
@@ -14,7 +14,7 @@
public abstract class UIToolTip extends UIComponentBase implements org.ajax4jsf.component.AjaxChildrenEncoder{
- public static final String COMPONENT_TYPE = "org.richfaces.toolTip";
+ public static final String COMPONENT_TYPE = "org.richfaces.component.ToolTip";
public static final String CONTENT_FACET_NAME = "defaultContent";
public abstract String getValue();
Deleted: trunk/ui/tooltip/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/ui/tooltip/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-08-09 13:50:14 UTC (rev 2173)
+++ trunk/ui/tooltip/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-08-09 14:01:04 UTC (rev 2174)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * 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/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java
===================================================================
--- trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java (rev 0)
+++ trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java 2007-08-09 14:01:04 UTC (rev 2174)
@@ -0,0 +1,153 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * @author Alexej Kushunin - mailto:akushunini at exadel.com created 09.08.2007
+ */
+
+public class TooltipComponentTest extends AbstractAjax4JsfTestCase {
+
+ private UIComponent form;
+
+ private UIToolTip tooltip1;
+ private UIToolTip tooltip2;
+ private static Set javaScripts = new HashSet();
+
+ static {
+
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/tooltip.js");
+ javaScripts.add("prototype.js");
+ }
+
+ public TooltipComponentTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+ tooltip1 = (UIToolTip) application
+ .createComponent(UIToolTip.COMPONENT_TYPE);
+ tooltip2 = (UIToolTip) application
+ .createComponent(UIToolTip.COMPONENT_TYPE);
+ tooltip1.setId("tooltip1");
+ tooltip1.setLayout("block");
+ form.getChildren().add(tooltip1);
+ tooltip2.setId("tooltip2");
+ tooltip2.setLayout("inline");
+ form.getChildren().add(tooltip2);
+
+ }
+
+ public void testRender() throws Exception {
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //System.out.println(page.asXml());
+
+ }
+
+ public void testToolTipStyles() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ if(links.size()==0){fail();}
+ for (int i = 0; i < links.size(); i++) {
+ HtmlElement link = (HtmlElement) links.get(i);
+ assertTrue(link.getAttributeValue("href").contains(
+ "css/tooltip.xcss"));
+ }
+ }
+
+ public void testToolTipScrits() throws Exception {
+ HtmlPage page = renderView();
+ 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 (item.getFirstChild() != null) {
+ String scriptBodyString = item.getFirstChild().toString();
+ if (scriptBodyString.contains("new ToolTip")) {
+ assertTrue(scriptBodyString.contains("A4J.AJAX.Submit"));
+ assertTrue(scriptBodyString.contains("Richfaces.tooltips"));
+ }
+ }
+
+ 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);
+ }
+ }
+ }
+ public void testBroadcast() throws Exception{
+ FacesEvent fe = new AjaxEvent(tooltip1);
+ try{
+ tooltip1.broadcast(fe);
+ }catch(Exception e){fail();}
+ }
+
+ public void testComponent() {
+ assertTrue(true);
+ }
+
+ public void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ form = null;
+ tooltip1 = null;
+ tooltip2 = null;
+ super.tearDown();
+ }
+}
Property changes on: trunk/ui/tooltip/src/test/java/org/richfaces/component/TooltipComponentTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: trunk/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java
===================================================================
--- trunk/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java 2007-08-09 13:50:14 UTC (rev 2173)
+++ trunk/ui/tooltip/src/test/java/org/richfaces/renderkit/html/ToolTipRendererTest.java 2007-08-09 14:01:04 UTC (rev 2174)
@@ -6,19 +6,11 @@
public class ToolTipRendererTest extends AbstractAjax4JsfTestCase{
- public ToolTipRendererTest(String name) {
+
+ public ToolTipRendererTest(String name){
super(name);
- // TODO Auto-generated constructor stub
- }
-
-
- public void setUp() throws Exception {
- // TODO Auto-generated method stub
- super.setUp();
}
-
-
protected void setupResponseWriter() throws IOException {
// TODO Auto-generated method stub
super.setupResponseWriter();
@@ -29,12 +21,5 @@
// TODO Auto-generated method stub
super.setupWebClient();
}
-
-
- public void tearDown() throws Exception {
- // TODO Auto-generated method stub
- super.tearDown();
- }
-
}
More information about the richfaces-svn-commits
mailing list