public void CData() { //arrange const string TestHtml = "<div runat='server'>\nTest\n<span style='color:red;'>\nRed Test\n<![CDATA[\n alert('hello'); \n<html im script />]]>\n</span>\n</div>"; var e = new Html.Element(); e.Text = TestHtml; var text = e.Text; var cdata = e.Find<Html.Literal>(n => n.LiteralToken.Class == TokenClass.CData); Assert.AreEqual("\n alert('hello'); \n<html im script />", cdata.Value); Assert.AreEqual(true, e.IsServerControl); Assert.AreEqual(TestHtml, text); }
public void Script() { //arrange const string TestHtml = "<div runat='server'>\nTest\n<span style='color:red;'>\nRed Test\n<script runat='server'>\n alert('hello'); \n<html im script />\n</script>\n</span>\n</div>"; var e = new Html.Element(); e.Text = TestHtml; var text = e.Text; var script = e.Find<Html.Script>(); Assert.AreEqual("div", e.Name); Assert.AreEqual("\n alert('hello'); \n<html im script />\n", script.Value); Assert.AreEqual(true, e.IsServerControl); Assert.AreEqual(TestHtml, text); }