Skip to content

Commit 600a2ff

Browse files
committed
more tests
1 parent db185be commit 600a2ff

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/test/java/org/htmlunit/html/DomNode2Test.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,28 @@ public void getRootNode() throws Exception {
140140

141141
loadPageVerifyTitle2(content);
142142
}
143+
144+
/**
145+
* @throws Exception on test failure
146+
*/
147+
@Test
148+
@Alerts("beforeafter")
149+
public void textContentCdata() throws Exception {
150+
final String content = "<html>\n"
151+
+ "<head>\n"
152+
+ " <script>\n"
153+
+ LOG_TITLE_FUNCTION
154+
+ " function test() {\n"
155+
+ " log(document.getElementById('tester').textContent);\n"
156+
+ " }\n"
157+
+ " </script>\n"
158+
+ "</head>\n"
159+
+ "<body onload='test()'>\n"
160+
+ "<div id='tester'>before<![CDATA[inside]]>after</div>\n"
161+
+ "</body>\n"
162+
+ "</html>";
163+
164+
loadPageVerifyTitle2(content);
165+
}
166+
143167
}

src/test/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText2Test.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,18 @@ public void getVisibleTextDetailsOpen() throws Exception {
17641764
+ "</details>");
17651765
}
17661766

1767+
1768+
/**
1769+
* @throws Exception if the test fails
1770+
*/
1771+
@Test
1772+
@Alerts("beforeafter")
1773+
public void getVisibleTextCdata() throws Exception {
1774+
getVisibleTextFormated("<div id='tester'>"
1775+
+ "before<![CDATA[inside]]>after"
1776+
+ "</div>");
1777+
}
1778+
17671779
private void getVisibleTextFormated(final String htmlTesterSnipped) throws Exception {
17681780
final String htmlContent
17691781
= "<html>\n"

0 commit comments

Comments
 (0)