logo       

[HtmlUnit] CVS Commit: DomTextTest.java: added test for DomText.asText()..: msg#00049

java.htmlunit.devel

Subject: [HtmlUnit] CVS Commit: DomTextTest.java: added test for DomText.asText()...

Log Message:
-----------
added test for DomText.asText()... as notYetImplemented()

Added Files:
-----------
htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html:
DomTextTest.java

(http://cvs.sourceforge.net/viewcvs.py/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomTextTest.java?rev=1.1&content-type=text/x-cvsweb-markup)

Revision Data
-------------
--- /dev/null
+++ src/test/java/com/gargoylesoftware/htmlunit/html/DomTextTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2002-2006 Gargoyle Software Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment:
+ *
+ * "This product includes software developed by Gargoyle Software Inc.
+ * (http://www.GargoyleSoftware.com/)."
+ *
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ * 4. The name "Gargoyle Software" must not be used to endorse or promote
+ * products derived from this software without prior written permission.
+ * For written permission, please contact info@xxxxxxxxxxxxxxxxxxxxx
+ * 5. Products derived from this software may not be called "HtmlUnit", nor may
+ * "HtmlUnit" appear in their name, without prior written permission of
+ * Gargoyle Software Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE
+ * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.gargoylesoftware.htmlunit.html;
+
+import com.gargoylesoftware.htmlunit.WebTestCase;
+
+/**
+ * Tests for {@link DomText}.
+ *
+ * @version $Revision: 1.1 $
+ * @author Marc Guillemot
+ */
+public class DomTextTest extends WebTestCase {
+
+ /**
+ * Create an instance
+ * @param name Name of the test
+ */
+ public DomTextTest(final String name) {
+ super(name);
+ }
+
+ /**
+ * Test the clean up of   in strings
+ * @throws Exception if the test fails
+ */
+ public void testAsText() throws Exception {
+ if (notYetImplemented()) {
+ return;
+ }
+ final String content = "<html><body><span id='foo'>a b&nbsp;c d
&nbsp;e</span></body></html>";
+
+ final HtmlPage page = loadPage(content);
+ final HtmlElement elt = page.getHtmlElementById("foo");
+ assertEquals("a b c d e", elt.asText());
+
+ final DomNode node = elt.getFirstChild();
+ assertEquals("a b c d e", node.asText());
+ }
+}


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise