Author: abelevich
Date: 2008-11-28 04:40:23 -0500 (Fri, 28 Nov 2008)
New Revision: 11421
Modified:
trunk/ui/inplaceInput/src/test/java/org/richfaces/component/InplaceInputComponentTest.java
trunk/ui/inplaceInput/src/test/java/org/richfaces/rendekit/InplaceInputRendererTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5068
Modified:
trunk/ui/inplaceInput/src/test/java/org/richfaces/component/InplaceInputComponentTest.java
===================================================================
---
trunk/ui/inplaceInput/src/test/java/org/richfaces/component/InplaceInputComponentTest.java 2008-11-27
19:34:54 UTC (rev 11420)
+++
trunk/ui/inplaceInput/src/test/java/org/richfaces/component/InplaceInputComponentTest.java 2008-11-28
09:40:23 UTC (rev 11421)
@@ -32,7 +32,9 @@
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
+import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlLink;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlScript;
@@ -41,7 +43,7 @@
UIForm form;
UIInplaceInput iinput;
- private static Set javaScripts = new HashSet();
+ private static Set <String>javaScripts = new HashSet<String>();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
@@ -64,8 +66,6 @@
iinput =
(UIInplaceInput)application.createComponent("org.richfaces.InplaceInput");
iinput.setValue("New York");
form.getChildren().add(iinput);
-
-
}
public void testRenderer() throws Exception {
@@ -76,30 +76,35 @@
public void testComboBoxStyles() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- List links = page.getDocumentElement().getHtmlElementsByTagName("link");
- if(links.size()==0){fail();}
+ List <HtmlLink> links =
page.getDocumentHtmlElement().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/inplaceinput.xcss"));
+ assertTrue(link.getAttributeValue("href").contains("css/inplaceinput.xcss"));
}
}
public void testComboBoxScripts() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ List <HtmlScript> scripts =
page.getDocumentHtmlElement().getHtmlElementsByTagName("script");
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
+ for (Iterator <HtmlScript> it = scripts.iterator(); it.hasNext();) {
+
+ HtmlScript item = it.next();
String srcAttr = item.getSrcAttribute();
- if (item.getFirstChild() != null) {
- String scriptBodyString = item.getFirstChild().toString();
- assertTrue(scriptBodyString.contains("Richfaces.InplaceInput"));
+
+ if (item.getFirstDomChild() != null) {
+ DomNode script = item.getFirstDomChild();
+ assertTrue(script.getNodeValue().contains("Richfaces.InplaceInput"));
}
+
if (StringUtils.isNotBlank(srcAttr)) {
boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ for (Iterator <String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
String src = (String) srcIt.next();
found = srcAttr.contains(src);
if (found) {
@@ -111,7 +116,6 @@
}
}
-
public void tearDown() throws Exception {
super.tearDown();
}
Modified:
trunk/ui/inplaceInput/src/test/java/org/richfaces/rendekit/InplaceInputRendererTest.java
===================================================================
---
trunk/ui/inplaceInput/src/test/java/org/richfaces/rendekit/InplaceInputRendererTest.java 2008-11-27
19:34:54 UTC (rev 11420)
+++
trunk/ui/inplaceInput/src/test/java/org/richfaces/rendekit/InplaceInputRendererTest.java 2008-11-28
09:40:23 UTC (rev 11421)
@@ -23,7 +23,9 @@
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.richfaces.component.UIInplaceInput;
import org.richfaces.renderkit.html.InplaceInputRenderer;
+import org.w3c.dom.Node;
+import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;