@@ -35,7 +35,7 @@ public class DomCommentTest extends SimpleWebTestCase {
3535 */
3636 @ Test
3737 public void asNormalizedText () throws Exception {
38- final String content = "<html><body><!-- a comment --></body></html>" ;
38+ final String content = DOCTYPE_HTML + "<html><body><!-- a comment --></body></html>" ;
3939 final HtmlPage page = loadPage (content );
4040 assertEquals ("" , page .asNormalizedText ());
4141 }
@@ -47,7 +47,7 @@ public void asNormalizedText() throws Exception {
4747 @ Test
4848 public void asXml () throws Exception {
4949 final String comment = "<!-- a comment -->" ;
50- final String content = "<html><body><span id='foo'>" + comment + "</span></body></html>" ;
50+ final String content = DOCTYPE_HTML + "<html><body><span id='foo'>" + comment + "</span></body></html>" ;
5151 final HtmlPage page = loadPage (content );
5252 final HtmlElement elt = page .getHtmlElementById ("foo" );
5353 final DomNode node = elt .getFirstChild ();
@@ -60,7 +60,7 @@ public void asXml() throws Exception {
6060 */
6161 @ Test
6262 public void textSibling () throws Exception {
63- final String content = "<html><body id='body'><!-- c1 -->text<!-- c2 --></body></html>" ;
63+ final String content = DOCTYPE_HTML + "<html><body id='body'><!-- c1 -->text<!-- c2 --></body></html>" ;
6464 final HtmlPage page = loadPage (content );
6565 final DomNode node = page .getHtmlElementById ("body" ).getFirstChild ();
6666 assertEquals (DomText .NODE_NAME , node .getNextSibling ().getNodeName ());
@@ -71,7 +71,7 @@ public void textSibling() throws Exception {
7171 */
7272 @ Test
7373 public void setTextContent () throws Exception {
74- final String html = "<html><body><span id='s'><!--abc--></span></body></html>" ;
74+ final String html = DOCTYPE_HTML + "<html><body><span id='s'><!--abc--></span></body></html>" ;
7575 final HtmlPage page = loadPage (html );
7676 final DomComment comment = (DomComment ) page .getElementById ("s" ).getFirstChild ();
7777 assertEquals ("abc" , comment .getTextContent ());
@@ -87,7 +87,7 @@ public void setTextContent() throws Exception {
8787 */
8888 @ Test
8989 public void getCanonicalXPath_withoutCommentSiblings () throws Exception {
90- final String html = "<html><body><span id='s'><!--abc--></span></body></html>" ;
90+ final String html = DOCTYPE_HTML + "<html><body><span id='s'><!--abc--></span></body></html>" ;
9191 final HtmlPage page = loadPage (html );
9292 final DomComment comment = (DomComment ) page .getElementById ("s" ).getFirstChild ();
9393 assertEquals ("/html/body/span/comment()" , comment .getCanonicalXPath ());
@@ -102,7 +102,7 @@ public void getCanonicalXPath_withoutCommentSiblings() throws Exception {
102102 */
103103 @ Test
104104 public void getCanonicalXPath_withCommentSiblings () throws Exception {
105- final String html = "<html><body><span id='s'><!--abc--><br/><!--def--></span></body></html>" ;
105+ final String html = DOCTYPE_HTML + "<html><body><span id='s'><!--abc--><br/><!--def--></span></body></html>" ;
106106 final HtmlPage page = loadPage (html );
107107
108108 final DomComment comment1 = (DomComment ) page .getElementById ("s" ).getFirstChild ();
0 commit comments