From 600a2ff59929c662b2911413a7a1e977760d0645 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Mon, 4 Nov 2024 17:36:31 +0100 Subject: [PATCH] more tests --- .../java/org/htmlunit/html/DomNode2Test.java | 24 +++++++++++++++++++ .../HtmlSerializerVisibleText2Test.java | 12 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/test/java/org/htmlunit/html/DomNode2Test.java b/src/test/java/org/htmlunit/html/DomNode2Test.java index a868c90761b..e6995c288d7 100644 --- a/src/test/java/org/htmlunit/html/DomNode2Test.java +++ b/src/test/java/org/htmlunit/html/DomNode2Test.java @@ -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 = "\n" + + "\n" + + " \n" + + "\n" + + "\n" + + "
beforeafter
\n" + + "\n" + + ""; + + loadPageVerifyTitle2(content); + } + } diff --git a/src/test/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText2Test.java b/src/test/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText2Test.java index b02875853eb..64bd4b7d91d 100644 --- a/src/test/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText2Test.java +++ b/src/test/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText2Test.java @@ -1764,6 +1764,18 @@ public void getVisibleTextDetailsOpen() throws Exception { + ""); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("beforeafter") + public void getVisibleTextCdata() throws Exception { + getVisibleTextFormated("
" + + "beforeafter" + + "
"); + } + private void getVisibleTextFormated(final String htmlTesterSnipped) throws Exception { final String htmlContent = "\n"