public void OtherElementIsNotAffected() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml("<p>this is a <u>test</u>.</p>"); var transformer = new RemoveUnwantedNodesFormatter(new[] { "b" }, true); transformer.FormatHtml(htmlDocument); Assert.AreEqual("<p>this is a <u>test</u>.</p>", htmlDocument.DocumentNode.OuterHtml); }
public void CommentIsRemoved() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml("<p>this is a <!-- comment -->.</p>"); var transformer = new RemoveUnwantedNodesFormatter(new[] { "comment()" }); transformer.FormatHtml(htmlDocument); Assert.AreEqual("<p>this is a .</p>", htmlDocument.DocumentNode.OuterHtml); }
public void UnwantedElementIsRemovedIncludingChildNodes() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml("<p>this is a <u>test</u>.</p>"); var transformer = new RemoveUnwantedNodesFormatter(new[] { "u" }, true); transformer.FormatHtml(htmlDocument); Assert.AreEqual("<p>this is a .</p>", htmlDocument.DocumentNode.OuterHtml); }