JBoss Rich Faces SVN: r298 - trunk/richfaces/tabPanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-06 04:42:42 -0400 (Fri, 06 Apr 2007)
New Revision: 298
Modified:
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
Log:
test updated
Modified: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-06 08:42:02 UTC (rev 297)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-06 08:42:42 UTC (rev 298)
@@ -24,7 +24,6 @@
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.HtmlTab;
@@ -52,9 +51,9 @@
javaScripts.add("org/richfaces/renderkit/html/scripts/tabPanel.js");
}
- private HtmlTabPanel tabPanel;
- private HtmlTab tab1;
- private HtmlTab tab2;
+ private UITabPanel tabPanel;
+ private UITab tab1;
+ private UITab tab2;
private UIForm form;
/**
@@ -76,15 +75,15 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- tabPanel = (HtmlTabPanel)application.createComponent(HtmlTabPanel.COMPONENT_TYPE);
+ tabPanel = (HtmlTabPanel)application.createComponent("org.richfaces.TabPanel");
tabPanel.setId("tabPanel");
form.getChildren().add(tabPanel);
- tab1 = (HtmlTab)application.createComponent(HtmlTab.COMPONENT_TYPE);
+ tab1 = (HtmlTab)application.createComponent("org.richfaces.Tab");
tab1.setId("tab1");
tabPanel.getChildren().add(tab1);
- tab2 = (HtmlTab)application.createComponent(HtmlTab.COMPONENT_TYPE);
+ tab2 = (HtmlTab)application.createComponent("org.richfaces.Tab");
tab2.setId("tab2");
tabPanel.getChildren().add(tab2);
}
@@ -101,80 +100,67 @@
}
/**
- * Test component default values
- *
- * @throws Exception
- */
- public void testDefaultValues() throws Exception {
- Assert.assertEquals("server", tabPanel.getSwitchType());
- Assert.assertEquals("left", tabPanel.getHeaderAlignment());
- Assert.assertEquals("1px", tabPanel.getHeaderSpacing());
-
- Assert.assertEquals(tab1.getId(), tab1.getName());
- Assert.assertEquals(tab2.getId(), tab2.getName());
- }
- /**
* Test component rendering
*
* @throws Exception
*/
public void testRender() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement table = page.getHtmlElementById(form.getId() + ":" + tabPanel.getId());
- Assert.assertNotNull(table);
- Assert.assertEquals("table", table.getNodeName());
+ HtmlElement table = page.getHtmlElementById(tabPanel.getClientId(facesContext));
+ assertNotNull(table);
+ assertEquals("table", table.getNodeName());
String classAttr = table.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("rich-tabpanel"));
+ assertTrue(classAttr.contains("rich-tabpanel"));
- HtmlElement cell1 = page.getHtmlElementById(form.getId() + ":" + tab1.getId() + "_cell");
- Assert.assertNotNull(cell1);
- Assert.assertEquals("td", cell1.getNodeName());
+ HtmlElement cell1 = page.getHtmlElementById(tab1.getClientId(facesContext) + "_cell");
+ assertNotNull(cell1);
+ assertEquals("td", cell1.getNodeName());
String classAttr1 = cell1.getAttributeValue("class");
- Assert.assertTrue(classAttr1.contains("dr-tbpnl-tbcell-act"));
- Assert.assertTrue(classAttr1.contains("rich-tabhdr-cell-active"));
+ assertTrue(classAttr1.contains("dr-tbpnl-tbcell-act"));
+ assertTrue(classAttr1.contains("rich-tabhdr-cell-active"));
- HtmlElement label1 = page.getHtmlElementById(form.getId() + ":" + tab1.getId() + "_lbl");
- Assert.assertNotNull(label1);
- Assert.assertEquals("td", label1.getNodeName());
+ HtmlElement label1 = page.getHtmlElementById(tab1.getClientId(facesContext) + "_lbl");
+ assertNotNull(label1);
+ assertEquals("td", label1.getNodeName());
assertEquals("RichFaces.overTab(this);", label1.getAttributeValue("onmouseover"));
assertEquals("RichFaces.outTab(this);", label1.getAttributeValue("onmouseout"));
String classAttrL1 = label1.getAttributeValue("class");
- Assert.assertTrue(classAttrL1.contains("dr-tbpnl-tb"));
- Assert.assertTrue(classAttrL1.contains("rich-tab-header"));
- Assert.assertTrue(classAttrL1.contains("dr-tbpnl-tb-act"));
- Assert.assertTrue(classAttrL1.contains("rich-tab-active"));
+ assertTrue(classAttrL1.contains("dr-tbpnl-tb"));
+ assertTrue(classAttrL1.contains("rich-tab-header"));
+ assertTrue(classAttrL1.contains("dr-tbpnl-tb-act"));
+ assertTrue(classAttrL1.contains("rich-tab-active"));
- HtmlElement cell2 = page.getHtmlElementById(form.getId() + ":" + tab2.getId() + "_cell");
- Assert.assertNotNull(cell2);
- Assert.assertEquals("td", cell2.getNodeName());
+ HtmlElement cell2 = page.getHtmlElementById(tab2.getClientId(facesContext) + "_cell");
+ assertNotNull(cell2);
+ assertEquals("td", cell2.getNodeName());
String classAttr2 = cell2.getAttributeValue("class");
- Assert.assertTrue(classAttr2.contains("dr-tbpnl-tbcell-inact"));
- Assert.assertTrue(classAttr2.contains("rich-tabhdr-cell-inactive"));
+ assertTrue(classAttr2.contains("dr-tbpnl-tbcell-inact"));
+ assertTrue(classAttr2.contains("rich-tabhdr-cell-inactive"));
- HtmlElement label2 = page.getHtmlElementById(form.getId() + ":" + tab2.getId() + "_lbl");
- Assert.assertNotNull(label2);
- Assert.assertEquals("td", label2.getNodeName());
+ HtmlElement label2 = page.getHtmlElementById(tab2.getClientId(facesContext) + "_lbl");
+ assertNotNull(label2);
+ assertEquals("td", label2.getNodeName());
assertEquals("RichFaces.overTab(this);", label1.getAttributeValue("onmouseover"));
assertEquals("RichFaces.outTab(this);", label1.getAttributeValue("onmouseout"));
String classAttrL2 = label2.getAttributeValue("class");
- Assert.assertTrue(classAttrL2.contains("dr-tbpnl-tb"));
- Assert.assertTrue(classAttrL2.contains("rich-tab-header"));
- Assert.assertTrue(classAttrL2.contains("dr-tbpnl-tb-inact"));
- Assert.assertTrue(classAttrL2.contains("rich-tab-inactive"));
+ assertTrue(classAttrL2.contains("dr-tbpnl-tb"));
+ assertTrue(classAttrL2.contains("rich-tab-header"));
+ assertTrue(classAttrL2.contains("dr-tbpnl-tb-inact"));
+ assertTrue(classAttrL2.contains("rich-tab-inactive"));
- HtmlElement tab = page.getHtmlElementById(form.getId() + ":" + tab1.getId());
- Assert.assertNotNull(tab);
- Assert.assertEquals("td", tab.getNodeName());
+ HtmlElement tab = page.getHtmlElementById(tab1.getClientId(facesContext));
+ assertNotNull(tab);
+ assertEquals("td", tab.getNodeName());
}
/**
@@ -184,11 +170,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/tabPanel.xcss"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/tabPanel.xcss"));
}
/**
@@ -198,7 +184,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();
17 years, 1 month
JBoss Rich Faces SVN: r297 - in trunk/richfaces/suggestionbox/src/test/java/org/richfaces: component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
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();
17 years, 1 month
JBoss Rich Faces SVN: r296 - trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-06 04:41:03 -0400 (Fri, 06 Apr 2007)
New Revision: 296
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-06 08:40:17 UTC (rev 295)
+++ trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2007-04-06 08:41:03 UTC (rev 296)
@@ -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.HtmlSimpleTogglePanel;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
@@ -52,7 +50,7 @@
javaScripts.add("org/richfaces/renderkit/html/scripts/simpleTogglePanel.js");
}
- private HtmlSimpleTogglePanel ui;
+ private UISimpleTogglePanel ui;
private UIForm form;
/**
@@ -74,7 +72,7 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- ui = (HtmlSimpleTogglePanel)application.createComponent(HtmlSimpleTogglePanel.COMPONENT_TYPE);
+ ui = (UISimpleTogglePanel)application.createComponent("org.richfaces.SimpleTogglePanel");
ui.setId("simpleTogglePanel");
form.getChildren().add(ui);
@@ -90,47 +88,38 @@
}
/**
- * Test component default values
- *
- * @throws Exception
- */
- public void testDefaultValues() throws Exception {
- assertEquals("100%", ui.getWidth());
- assertEquals(true, ui.isOpened());
- }
- /**
* Test component rendering
*
* @throws Exception
*/
public void testRender() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement div1 = page.getHtmlElementById(form.getId() + ":" + ui.getId());
- Assert.assertNotNull(div1);
- Assert.assertEquals("div", div1.getNodeName());
+ HtmlElement div1 = page.getHtmlElementById(ui.getClientId(facesContext));
+ assertNotNull(div1);
+ assertEquals("div", div1.getNodeName());
String classAttr1 = div1.getAttributeValue("class");
- Assert.assertTrue(classAttr1.contains("dr-stglpnl"));
- Assert.assertTrue(classAttr1.contains("rich-stglpanel"));
+ assertTrue(classAttr1.contains("dr-stglpnl"));
+ assertTrue(classAttr1.contains("rich-stglpanel"));
- HtmlElement div2 = page.getHtmlElementById(form.getId() + ":" + ui.getId() + "_header");
- Assert.assertNotNull(div2);
- Assert.assertEquals("div", div2.getNodeName());
+ HtmlElement div2 = page.getHtmlElementById(ui.getClientId(facesContext) + "_header");
+ assertNotNull(div2);
+ assertEquals("div", div2.getNodeName());
String classAttr2 = div2.getAttributeValue("class");
- Assert.assertTrue(classAttr2.contains("dr-stglpnl-h"));
- Assert.assertTrue(classAttr2.contains("rich-stglpanel-header"));
+ assertTrue(classAttr2.contains("dr-stglpnl-h"));
+ assertTrue(classAttr2.contains("rich-stglpanel-header"));
- HtmlElement div3 = page.getHtmlElementById(form.getId() + ":" + ui.getId() + "_switch");
- Assert.assertNotNull(div3);
- Assert.assertEquals("div", div3.getNodeName());
+ HtmlElement div3 = page.getHtmlElementById(ui.getClientId(facesContext) + "_switch");
+ assertNotNull(div3);
+ assertEquals("div", div3.getNodeName());
- HtmlElement div4 = page.getHtmlElementById(form.getId() + ":" + ui.getId() + "_body");
- Assert.assertNotNull(div4);
- Assert.assertEquals("div", div4.getNodeName());
+ HtmlElement div4 = page.getHtmlElementById(ui.getClientId(facesContext) + "_body");
+ assertNotNull(div4);
+ assertEquals("div", div4.getNodeName());
}
/**
@@ -140,11 +129,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/simpleTogglePanel.xcss"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/simpleTogglePanel.xcss"));
}
/**
@@ -154,7 +143,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();
17 years, 1 month
JBoss Rich Faces SVN: r295 - in trunk/richfaces/separator/src/test/java/org/richfaces: component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-06 04:40:17 -0400 (Fri, 06 Apr 2007)
New Revision: 295
Removed:
trunk/richfaces/separator/src/test/java/org/richfaces/component/html/
trunk/richfaces/separator/src/test/java/org/richfaces/taglib/
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-06 08:39:42 UTC (rev 294)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2007-04-06 08:40:17 UTC (rev 295)
@@ -23,9 +23,7 @@
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import junit.framework.Assert;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.html.HtmlSeparator;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
@@ -37,7 +35,7 @@
*/
public class SeparatorComponentTest extends AbstractAjax4JsfTestCase {
- private HtmlSeparator ui;
+ private UISeparator ui;
private UIComponent form;
private UIOutput out1;
private UIOutput out2;
@@ -66,7 +64,7 @@
out1.setValue("output1");
form.getChildren().add(out1);
- ui = (HtmlSeparator)application.createComponent(HtmlSeparator.COMPONENT_TYPE);
+ ui = (UISeparator)application.createComponent("org.richfaces.separator");
ui.setId("separator");
form.getChildren().add(ui);
@@ -87,36 +85,23 @@
}
/**
- * 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
*/
public void testRender() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement div1 = page.getHtmlElementById(form.getId() + ":" + ui.getId());
- Assert.assertNotNull(div1);
- Assert.assertEquals("div", div1.getNodeName());
+ HtmlElement div1 = page.getHtmlElementById(ui.getClientId(facesContext));
+ assertNotNull(div1);
+ assertEquals("div", div1.getNodeName());
HtmlElement div2 = (HtmlElement)div1.getHtmlElementsByTagName("div").get(0);
String classAttr = div2.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("rich-separator"));
+ assertTrue(classAttr.contains("rich-separator"));
String styleAttr = div2.getAttributeValue("style");
- Assert.assertTrue(styleAttr.contains("org.richfaces.renderkit.html.images.BevelSeparatorImage"));
+ assertTrue(styleAttr.contains("org.richfaces.renderkit.html.images.BevelSeparatorImage"));
}
}
17 years, 1 month
JBoss Rich Faces SVN: r293 - in trunk/richfaces/datascroller/src/test/java/org/richfaces: component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-06 04:37:12 -0400 (Fri, 06 Apr 2007)
New Revision: 293
Removed:
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java
trunk/richfaces/datascroller/src/test/java/org/richfaces/taglib/
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-05 19:54:10 UTC (rev 292)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-06 08:37:12 UTC (rev 293)
@@ -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.HtmlDatascroller;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
@@ -49,7 +47,7 @@
javaScripts.add("prototype.js");
}
- private HtmlDatascroller scroller;
+ private UIDatascroller scroller;
private UIComponent form;
private UIData data;
@@ -77,7 +75,7 @@
data.setRows(5);
form.getChildren().add(data);
- scroller = (HtmlDatascroller)application.createComponent(HtmlDatascroller.COMPONENT_TYPE);
+ scroller = (UIDatascroller)application.createComponent("org.richfaces.Datascroller");
scroller.setId("dataScroller");
scroller.setFor(data.getId());
@@ -95,36 +93,22 @@
}
/**
- * 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
*/
public void testRender() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById(form.getId() + ":" + scroller.getId());
- Assert.assertNotNull(div);
- Assert.assertEquals("div", div.getNodeName());
+ HtmlElement div = page.getHtmlElementById(scroller.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
String classAttr = div.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-dscr"));
- Assert.assertTrue(classAttr.contains("rich-datascr"));
+ assertTrue(classAttr.contains("dr-dscr"));
+ assertTrue(classAttr.contains("rich-datascr"));
}
/**
@@ -134,12 +118,12 @@
*/
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/datascroller.xcss"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/datascroller.xcss"));
}
/**
@@ -149,7 +133,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();) {
Deleted: 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-05 19:54:10 UTC (rev 292)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/html/HtmlDatascrollerTest.java 2007-04-06 08:37:12 UTC (rev 293)
@@ -1,61 +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.html;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-/**
- * Unit test for HtmlDatascroller.
- */
-public class HtmlDatascrollerTest extends AbstractAjax4JsfTestCase {
- public HtmlDatascrollerTest(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 {
- HtmlDatascroller ds = new HtmlDatascroller();
- ds.setStyleClass("styleClass");
- Object state = ds.saveState(facesContext);
- HtmlDatascroller newDs = new HtmlDatascroller();
- newDs.restoreState(facesContext, state);
- assertEquals("styleClass", newDs.getStyleClass());
- }
-}
17 years, 1 month
JBoss Rich Faces SVN: r292 - in trunk/richfaces/tabPanel/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-05 15:54:10 -0400 (Thu, 05 Apr 2007)
New Revision: 292
Modified:
trunk/richfaces/tabPanel/src/main/java/org/richfaces/component/UITab.java
trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-71 fixed. Missing AjaxEvent queueing added
Modified: trunk/richfaces/tabPanel/src/main/java/org/richfaces/component/UITab.java
===================================================================
--- trunk/richfaces/tabPanel/src/main/java/org/richfaces/component/UITab.java 2007-04-05 14:54:01 UTC (rev 291)
+++ trunk/richfaces/tabPanel/src/main/java/org/richfaces/component/UITab.java 2007-04-05 19:54:10 UTC (rev 292)
@@ -92,7 +92,6 @@
* @see org.ajax4jsf.framework.ajax.AjaxActionComponent#setupReRender()
*/
protected void setupReRender() {
- // TODO Auto-generated method stub
super.setupReRender();
AjaxRendererUtils.addRegionByName(getFacesContext(), this, this.getId());
}
Modified: trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java
===================================================================
--- trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java 2007-04-05 14:54:01 UTC (rev 291)
+++ trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java 2007-04-05 19:54:10 UTC (rev 292)
@@ -31,10 +31,10 @@
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
import org.ajax4jsf.framework.renderer.ComponentVariables;
import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
-import org.ajax4jsf.framework.util.HtmlDimensions;
import org.ajax4jsf.framework.util.javascript.JSReference;
import org.ajax4jsf.framework.util.javascript.ScriptUtils;
import org.richfaces.component.UISwitchablePanel;
@@ -88,6 +88,10 @@
if (eventTab != null) {
new SwitchablePanelSwitchEvent(panel, null, eventTab).queue();
new ActionEvent(eventTab).queue();
+
+ if (UISwitchablePanel.AJAX_METHOD.equals(eventTab.getSwitchType())) {
+ new AjaxEvent(eventTab).queue();
+ }
} else {
String newValue = (String) requestParameterMap.get(clientId);
if (null != newValue) {
17 years, 1 month
JBoss Rich Faces SVN: r291 - in trunk/richfaces/menu-components/src/test: java/org/richfaces and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-05 10:54:01 -0400 (Thu, 05 Apr 2007)
New Revision: 291
Added:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/html/
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/html/HtmlMenuItemTest.java
trunk/richfaces/menu-components/src/test/java/org/richfaces/taglib/
trunk/richfaces/menu-components/src/test/java/org/richfaces/taglib/MenuItemTagTest.java
Removed:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java
trunk/richfaces/menu-components/src/test/resources/
Log:
MenuItem test cases development.
Deleted: 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-05 14:48:13 UTC (rev 290)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-05 14:54:01 UTC (rev 291)
@@ -1,94 +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;
-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 AbstractAjax4JsfTestCase
-{
-
- HtmlMenuItem menuItem;
-
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- 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 testRender() throws Exception
- {
- 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
- {
- 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);
- }
-}
Copied: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java (from rev 275, trunk/richfaces/menu-components/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java (rev 0)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2007-04-05 14:54:01 UTC (rev 291)
@@ -0,0 +1,211 @@
+/**
+ * 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.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+//import org.apache.commons.lang.StringUtils;
+
+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 com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import org.ajax4jsf.framework.renderer.ComponentVariables;
+import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+
+
+/**
+ * Unit test for simple Component.
+ */
+public class MenuItemComponentTest
+ extends AbstractAjax4JsfTestCase
+{
+ private static Set javaScripts = new HashSet();
+
+/* static {
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript()");
+ javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript()");
+ javaScripts.add("org.ajax4jsf.framework.util.command.CommandScript()");
+ }
+*/
+ private HtmlMenuItem menuItem;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public MenuItemComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ menuItem = (HtmlMenuItem) application.createComponent(HtmlMenuItem.COMPONENT_TYPE);
+ menuItem.setId("menuItem");
+ menuItem.setValue("Menu Item");
+
+ form.getChildren().add(menuItem);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ menuItem = null;
+ form = null;
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testMenuItemRender() throws Exception
+ {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById(form.getId() + ":" + menuItem.getId());
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ }
+
+ public void testMenuItemIconFacet() throws Exception
+ {
+ 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(form.getId() + ":" + menuItem.getId() + ":icon");
+ assertEquals("span", span.getNodeName());
+ assertNotNull(span);
+ }
+
+ public void testDisabledMenuItem() throws Exception
+ {
+ menuItem.setDisabled(true);
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":disabled");
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ String classAttr = span.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled"));
+
+ span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":icon");
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ classAttr = span.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-menu-icon dr-menu-icon-disabled rich-menu-item-icon rich-menu-item-icon-disabled"));
+
+ HtmlElement div = page.getHtmlElementById(form.getId() + ":" + menuItem.getId());
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ classAttr = div.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled"));
+ }
+
+ public void testEnabledMenuItem() throws Exception
+ {
+ assertEquals(false, menuItem.isDisabled());
+ menuItem.setIconClass("iconClass");
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement anchor = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":anchor");
+ assertNotNull(anchor);
+ assertEquals("a", anchor.getNodeName());
+ String classAttr = anchor.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-menu-label rich-menu-item-label"));
+
+ HtmlElement span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":icon");
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ classAttr = span.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon " + menuItem.getIconClass()));
+
+ HtmlElement div = page.getHtmlElementById(form.getId() + ":" + menuItem.getId());
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ classAttr = div.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled"));
+ }
+
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ //Assert.assertEquals(1, links.size());
+ Assert.assertNotNull(links);
+ HtmlElement link = (HtmlElement) links.get(0);
+ Assert.assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/menucomponents.xcss"));
+ }
+
+/* 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);
+ }
+ }
+ }
+*/
+}
Added: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/html/HtmlMenuItemTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/html/HtmlMenuItemTest.java (rev 0)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/html/HtmlMenuItemTest.java 2007-04-05 14:54:01 UTC (rev 291)
@@ -0,0 +1,63 @@
+/**
+ * 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 HtmlSuggestionBox.
+ */
+public class HtmlMenuItemTest extends AbstractAjax4JsfTestCase {
+ public HtmlMenuItemTest(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 {
+ HtmlMenuItem menuItem = new HtmlMenuItem();
+ menuItem.setStyleClass("styleClass");
+ menuItem.setStyle("style");
+ Object state = menuItem.saveState(facesContext);
+ HtmlMenuItem newMenuItem = new HtmlMenuItem();
+ newMenuItem.restoreState(facesContext, state);
+ assertEquals("styleClass", newMenuItem.getStyleClass());
+ assertEquals("style", newMenuItem.getStyle());
+ }
+}
Added: trunk/richfaces/menu-components/src/test/java/org/richfaces/taglib/MenuItemTagTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/taglib/MenuItemTagTest.java (rev 0)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/taglib/MenuItemTagTest.java 2007-04-05 14:54:01 UTC (rev 291)
@@ -0,0 +1,91 @@
+/**
+ * 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.HtmlMenuItem;
+
+import javax.faces.webapp.UIComponentTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+
+public class MenuItemTagTest extends AbstractAjax4JsfTestCase {
+
+ MenuItemTag tag;
+
+ public MenuItemTagTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ tag = new MenuItemTag();
+ 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.SuggestionBoxTag#setProperties(javax.faces.component.UIComponent)}.
+ * @throws JspException
+ */
+ public void testSetPropertiesUIComponent() throws JspException {
+ HtmlMenuItem menuItem = new HtmlMenuItem();
+
+ tag.setStyleClass("styleClass");
+ tag.setStyle("style");
+ tag.setProperties(menuItem);
+ assertEquals("styleClass", menuItem.getStyleClass());
+ assertEquals("style", menuItem.getStyle());
+ }
+}
17 years, 1 month
JBoss Rich Faces SVN: r290 - trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-05 10:48:13 -0400 (Thu, 05 Apr 2007)
New Revision: 290
Modified:
trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
Log:
MenuItem component development.
Modified: trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2007-04-05 14:46:01 UTC (rev 289)
+++ trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2007-04-05 14:48:13 UTC (rev 290)
@@ -167,9 +167,9 @@
if (resource.length() > 0) {
variables.setVariable("onclick", scriptValue.toString());
}
-
- variables.setVariable("value", getStringAttributeOrEmptyString(menuItem, "value"));
- }
+ }
+
+ variables.setVariable("value", getStringAttributeOrEmptyString(menuItem, "value"));
}
protected String getStringAttributeOrEmptyString(UIComponent component, String attributeName) {
17 years, 1 month
JBoss Rich Faces SVN: r289 - trunk/richfaces/tabPanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-05 10:46:01 -0400 (Thu, 05 Apr 2007)
New Revision: 289
Added:
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
Removed:
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
test for TabPanel component added
Deleted: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-05 14:45:16 UTC (rev 288)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-05 14:46:01 UTC (rev 289)
@@ -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/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java (rev 0)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-05 14:46:01 UTC (rev 289)
@@ -0,0 +1,222 @@
+/**
+ * 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.HtmlTab;
+import org.richfaces.component.html.HtmlTabPanel;
+
+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 TabPanel component.
+ */
+public class TabPanelComponentTest 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/richfaces/renderkit/html/scripts/browser_info.js");
+ javaScripts.add("org/ajax4jsf/renderkit/html/scripts/form.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/tabPanel.js");
+ }
+
+ private HtmlTabPanel tabPanel;
+ private HtmlTab tab1;
+ private HtmlTab tab2;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public TabPanelComponentTest(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);
+
+ tabPanel = (HtmlTabPanel)application.createComponent(HtmlTabPanel.COMPONENT_TYPE);
+ tabPanel.setId("tabPanel");
+ form.getChildren().add(tabPanel);
+
+ tab1 = (HtmlTab)application.createComponent(HtmlTab.COMPONENT_TYPE);
+ tab1.setId("tab1");
+ tabPanel.getChildren().add(tab1);
+
+ tab2 = (HtmlTab)application.createComponent(HtmlTab.COMPONENT_TYPE);
+ tab2.setId("tab2");
+ tabPanel.getChildren().add(tab2);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ tabPanel = null;
+ tab1 = null;
+ tab2 = null;
+ form = null;
+ }
+
+ /**
+ * Test component default values
+ *
+ * @throws Exception
+ */
+ public void testDefaultValues() throws Exception {
+ Assert.assertEquals("server", tabPanel.getSwitchType());
+ Assert.assertEquals("left", tabPanel.getHeaderAlignment());
+ Assert.assertEquals("1px", tabPanel.getHeaderSpacing());
+
+ Assert.assertEquals(tab1.getId(), tab1.getName());
+ Assert.assertEquals(tab2.getId(), tab2.getName());
+ }
+ /**
+ * Test component rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ Assert.assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement table = page.getHtmlElementById(form.getId() + ":" + tabPanel.getId());
+ Assert.assertNotNull(table);
+ Assert.assertEquals("table", table.getNodeName());
+
+ String classAttr = table.getAttributeValue("class");
+ Assert.assertTrue(classAttr.contains("rich-tabpanel"));
+
+ HtmlElement cell1 = page.getHtmlElementById(form.getId() + ":" + tab1.getId() + "_cell");
+ Assert.assertNotNull(cell1);
+ Assert.assertEquals("td", cell1.getNodeName());
+
+ String classAttr1 = cell1.getAttributeValue("class");
+ Assert.assertTrue(classAttr1.contains("dr-tbpnl-tbcell-act"));
+ Assert.assertTrue(classAttr1.contains("rich-tabhdr-cell-active"));
+
+ HtmlElement label1 = page.getHtmlElementById(form.getId() + ":" + tab1.getId() + "_lbl");
+ Assert.assertNotNull(label1);
+ Assert.assertEquals("td", label1.getNodeName());
+
+ assertEquals("RichFaces.overTab(this);", label1.getAttributeValue("onmouseover"));
+ assertEquals("RichFaces.outTab(this);", label1.getAttributeValue("onmouseout"));
+
+ String classAttrL1 = label1.getAttributeValue("class");
+ Assert.assertTrue(classAttrL1.contains("dr-tbpnl-tb"));
+ Assert.assertTrue(classAttrL1.contains("rich-tab-header"));
+ Assert.assertTrue(classAttrL1.contains("dr-tbpnl-tb-act"));
+ Assert.assertTrue(classAttrL1.contains("rich-tab-active"));
+
+ HtmlElement cell2 = page.getHtmlElementById(form.getId() + ":" + tab2.getId() + "_cell");
+ Assert.assertNotNull(cell2);
+ Assert.assertEquals("td", cell2.getNodeName());
+
+ String classAttr2 = cell2.getAttributeValue("class");
+ Assert.assertTrue(classAttr2.contains("dr-tbpnl-tbcell-inact"));
+ Assert.assertTrue(classAttr2.contains("rich-tabhdr-cell-inactive"));
+
+ HtmlElement label2 = page.getHtmlElementById(form.getId() + ":" + tab2.getId() + "_lbl");
+ Assert.assertNotNull(label2);
+ Assert.assertEquals("td", label2.getNodeName());
+
+ assertEquals("RichFaces.overTab(this);", label1.getAttributeValue("onmouseover"));
+ assertEquals("RichFaces.outTab(this);", label1.getAttributeValue("onmouseout"));
+
+ String classAttrL2 = label2.getAttributeValue("class");
+ Assert.assertTrue(classAttrL2.contains("dr-tbpnl-tb"));
+ Assert.assertTrue(classAttrL2.contains("rich-tab-header"));
+ Assert.assertTrue(classAttrL2.contains("dr-tbpnl-tb-inact"));
+ Assert.assertTrue(classAttrL2.contains("rich-tab-inactive"));
+
+ HtmlElement tab = page.getHtmlElementById(form.getId() + ":" + tab1.getId());
+ Assert.assertNotNull(tab);
+ Assert.assertEquals("td", tab.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/tabPanel.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);
+ }
+ }
+ }
+}
17 years, 1 month