Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Nov 4, 2024
1 parent db185be commit 600a2ff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/org/htmlunit/html/DomNode2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,28 @@ public void getRootNode() throws Exception {

loadPageVerifyTitle2(content);
}

/**
* @throws Exception on test failure
*/
@Test
@Alerts("beforeafter")
public void textContentCdata() throws Exception {
final String content = "<html>\n"
+ "<head>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function test() {\n"
+ " log(document.getElementById('tester').textContent);\n"
+ " }\n"
+ " </script>\n"
+ "</head>\n"
+ "<body onload='test()'>\n"
+ "<div id='tester'>before<![CDATA[inside]]>after</div>\n"
+ "</body>\n"
+ "</html>";

loadPageVerifyTitle2(content);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,18 @@ public void getVisibleTextDetailsOpen() throws Exception {
+ "</details>");
}


/**
* @throws Exception if the test fails
*/
@Test
@Alerts("beforeafter")
public void getVisibleTextCdata() throws Exception {
getVisibleTextFormated("<div id='tester'>"
+ "before<![CDATA[inside]]>after"
+ "</div>");
}

private void getVisibleTextFormated(final String htmlTesterSnipped) throws Exception {
final String htmlContent
= "<html>\n"
Expand Down

0 comments on commit 600a2ff

Please sign in to comment.