Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8741/tests/tagTests
Modified Files:
StyleTagTest.java
Log Message:
Fix bug #900125 Style Tag Children not grouped
Added StyleScanner, a near copy of ScriptScanner.
Added testStyleChildren() in StyleTagTest to check it's operation.
Index: StyleTagTest.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/StyleTagTest.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** StyleTagTest.java 2 Jan 2004 16:24:57 -0000 1.35
--- StyleTagTest.java 29 Feb 2004 14:16:27 -0000 1.36
***************
*** 28,31 ****
--- 28,32 ----
import org.htmlparser.Parser;
+ import org.htmlparser.StringNode;
import org.htmlparser.tags.HeadTag;
import org.htmlparser.tags.Html;
***************
*** 65,69 ****
"</STYLE>";
createParser(style);
- Parser.setLineSeparator("\r\n");
parseAndAssertNodeCount(1);
assertTrue(node[0] instanceof StyleTag);
--- 66,69 ----
***************
*** 130,132 ****
--- 130,163 ----
assertStringEquals("Expected Style Code",expectedCode,styleTag.getStyleCode());
}
+
+ /**
+ * See bug #900125 Style Tag Children not grouped
+ */
+ public void testStyleChildren () throws ParserException
+ {
+ String style =
+ "\nbody {color:white}\n" +
+ "<!--\n" +
+ ".teliabox {\n" +
+ "color: #A9014E;\n" +
+ "text-align: center;\n" +
+ "background-image:url(hallo.gif);\n" +
+ "}\n" +
+ "-->";
+ String html =
+ "<style type=\"text/css\" media=\"screen\">" +
+ style +
+ "</style>";
+ StyleTag tag;
+ StringNode string;
+
+ createParser (html);
+ parseAndAssertNodeCount (1);
+ assertTrue ("Node should be a STYLE tag", node[0] instanceof StyleTag);
+ tag = (StyleTag)node[0];
+ assertTrue ("STYLE tag should have one child", 1 == tag.getChildCount ());
+ assertTrue ("Child should be a StringNode", tag.getChild (0) instanceof StringNode);
+ string = (StringNode)tag.getChild (0);
+ assertStringEquals ("Style text incorrect", style, string.toHtml ());
+ }
}
|