Skip to content

Commit

Permalink
Test for #1205
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed May 12, 2019
1 parent 7842f88 commit 82e2c44
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/test/java/org/jsoup/safety/CleanerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public class CleanerTest {

Document dirtyDoc = Jsoup.parse(dirty);
Document cleanDoc = new Cleaner(Whitelist.basic()).clean(dirtyDoc);
assertFalse(cleanDoc == null);
assertNotNull(cleanDoc);
assertEquals(0, cleanDoc.body().childNodeSize());
}

Expand Down Expand Up @@ -305,4 +305,11 @@ public void bailsIfRemovingProtocolThatsNotSet() {

assertEquals("<a rel=\"nofollow\">Clean</a>", clean);
}

@Test public void handlesNoHrefAttribute() {
String dirty = "<a>One</a> <a href>Two</a>";
Whitelist relaxedWithAnchor = Whitelist.relaxed().addProtocols("a", "href", "#");
String clean = Jsoup.clean(dirty, relaxedWithAnchor);
assertEquals("<a>One</a> \n<a>Two</a>", clean);
}
}

0 comments on commit 82e2c44

Please sign in to comment.