SF.net SVN: htmlunit: [1258] trunk/htmlunit/src

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SF.net SVN: htmlunit: [1258] trunk/htmlunit/src

mguillem
Revision: 1258
          http://svn.sourceforge.net/htmlunit/?rev=1258&view=rev
Author:   mguillem
Date:     2006-10-30 08:14:23 -0800 (Mon, 30 Oct 2006)

Log Message:
-----------
Fixed asText() for script node. Now returns an empty string (#1587246)

Modified Paths:
--------------
    trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java
    trunk/htmlunit/src/xdocs/changes.xml

Modified: trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
===================================================================
--- trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2006-10-30 15:29:44 UTC (rev 1257)
+++ trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2006-10-30 16:14:23 UTC (rev 1258)
@@ -224,4 +224,12 @@
             page.loadExternalJavaScriptFile(getSrcAttribute(), getCharsetAttribute());
         }
     }
+
+    /**
+     * @see com.gargoylesoftware.htmlunit.html.HtmlInput#asText()
+     * @return an empty string as the content of script is not visible by itself
+     */
+    public String asText() {
+        return "";
+    }
 }

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java 2006-10-30 15:29:44 UTC (rev 1257)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java 2006-10-30 16:14:23 UTC (rev 1258)
@@ -95,4 +95,21 @@
             assertEquals("not found", cause.getStatusMessage());
         }
     }
+
+    /**
+     * Verifies that a asText() returns "checked" or "unckecked" according to the state of the checkbox.
+     * @throws Exception if the test fails
+     */
+    public void testAsText() throws Exception {
+        final String htmlContent
+            = "<html><head><title>foo</title></head><body>"
+            + "<script id='script1'>"
+            + "    var foo = 132;"
+            + "</script></body></html>";
+
+        final HtmlPage page = loadPage(htmlContent);
+
+        final HtmlScript script = (HtmlScript) page.getHtmlElementById("script1");
+        assertEquals("", script.asText());
+    }
 }

Modified: trunk/htmlunit/src/xdocs/changes.xml
===================================================================
--- trunk/htmlunit/src/xdocs/changes.xml 2006-10-30 15:29:44 UTC (rev 1257)
+++ trunk/htmlunit/src/xdocs/changes.xml 2006-10-30 16:14:23 UTC (rev 1258)
@@ -7,6 +7,9 @@
 
     <body>
         <release version="1.10-prerelease">
+            <action type="update" dev="mguillem" id="1587246">
+                Fixed asText() for script node. Now returns an empty string.
+            </action>
             <action type="update" dev="mguillem" id="1575783">
                 Removed ":" in project id to avoid problems on Windows with plugins like idea.
             </action>


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop