Skip to content

Commit

Permalink
add test for issue #453 - fix is done in neko (#454)
Browse files Browse the repository at this point in the history
* add test for issue #453
use 4.2.0-SNAPSHOT

* code style

* add neko-htmlunit snapshot repo

* use neko 4.2.0 release

* neko-htmlunit version 4.2.1

* remove property
  • Loading branch information
rbri authored Jun 6, 2024
1 parent 00322fa commit e847d50
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/test/java/org/owasp/validator/html/test/AntiSamyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2666,4 +2666,40 @@ public void testBangCommentsWhenPreservingComments() throws ScanException, Polic
.getCleanHTML(),
not(containsString("mxss")));
}

@Test
public void testGithubIssue453() throws ScanException, PolicyException {
String test453 =
"<html lang=\"en\">\n"
+ "<head>\n"
+ "</head>\n"
+ "<table>\n"
+ "<SELECT NAME=\"Lang\">\n"
+ "<OPTION VALUE=\"da\">Dansk</OPTION>\n"
+ "<OPTION VALUE=\"en\" selected=selected>English</OPTION>\n"
+ "</SELECT>\n"
+ "</table>\n"
+ "</html>";
String cleaned = as.scan(test453, policy, AntiSamy.SAX).getCleanHTML();
cleaned = cleaned.replaceAll("\r?\n", "");
cleaned = cleaned.replaceAll("\\s\\s+", " ");

assertThat(
cleaned,
containsString(
"<body> <table> "
+ "<select name=\"Lang\"> "
+ "<option value=\"da\">Dansk</option> "));

cleaned = as.scan(test453, policy, AntiSamy.DOM).getCleanHTML();
cleaned = cleaned.replaceAll("\r?\n", "");
cleaned = cleaned.replaceAll("\\s\\s+", " ");

assertThat(
cleaned,
containsString(
"<body> <table> "
+ "<select name=\"Lang\"> "
+ "<option value=\"da\">Dansk</option> "));
}
}

0 comments on commit e847d50

Please sign in to comment.