Exemplo n.º 1
0
 public void TestHTMLComment()
 {
     HTML.Document d = HTML.Document.Parse("<!--comment-->spong");
     Assert.AreEqual("<html><head></head><body><p>spong</p></body></html>", d.ToString());
     d = HTML.Document.Parse("this and <!--comment--> that");
     Assert.AreEqual("<html><head></head><body><p>this and  that</p></body></html>", d.ToString());
 }
Exemplo n.º 2
0
 public void TestHTMLDefinitionList()
 {
     HTML.Document d = HTML.Document.Parse("<dl><dd>a<dt>b</dl>");
     Assert.AreEqual("<html><head></head><body><dl><dd>a</dd><dt>b</dt></dl></body></html>", d.ToString());
     d = HTML.Document.Parse("<dl><dd>a<dt><p>b</dl>");
     Assert.AreEqual("<html><head></head><body><dl><dd>a</dd><dt><p>b</p></dt></dl></body></html>", d.ToString());
 }
Exemplo n.º 3
0
 public void TestHTMLFlowContext()
 {
     HTML.Document d = HTML.Document.Parse("<blockquote>A<p>B</blockquote>");
     Assert.AreEqual("<html><head></head><body><blockquote><p>A</p><p>B</p></blockquote></body></html>", d.ToString());
     d = HTML.Document.Parse("<blockquote>A</pre><p>B</blockquote>");
     Assert.AreEqual("<html><head></head><body><blockquote><pre>A</pre><p>B</p></blockquote></body></html>", d.ToString());
 }
Exemplo n.º 4
0
 public void TestHTMLBlockQuote()
 {
     HTML.Document d = HTML.Document.Parse("<blockquote><p>T</blockquote>");
     Assert.AreEqual("<html><head></head><body><blockquote><p>T</p></blockquote></body></html>", d.ToString());
     d = HTML.Document.Parse("<blockquote>T</blockquote>");
     Assert.AreEqual("<html><head></head><body><blockquote>T</blockquote></body></html>", d.ToString());
 }
Exemplo n.º 5
0
 public void TestHTMLExplicitClose()
 {
     HTML.Document d = HTML.Document.Parse("<html><head><title>T</title></head><body>B</body></html>");
     Assert.AreEqual("<html><head><title>T</title></head><body><p>B</p></body></html>", d.ToString());
 }
Exemplo n.º 6
0
 public void TestHTMLXml()
 {
     HTML.Document d = HTML.Document.Parse("<meta http-equiv=\"something\" /><link rel=whatever /><link rel=alternate />");
     Assert.AreEqual("<html><head><meta http-equiv=\"something\"><link rel=\"whatever\"><link rel=\"alternate\"></head><body></body></html>", d.ToString());
     d = HTML.Document.Parse("<html a=a xml:lang=\"en-US\" z=z>T");
     Assert.AreEqual("<html a=\"a\" xml:lang=\"en-US\" z=\"z\"><head></head><body><p>T</p></body></html>", d.ToString());
 }
Exemplo n.º 7
0
 public void TestHTMLScript()
 {
     HTML.Document d = HTML.Document.Parse("<head><script><T</script>");
     Assert.AreEqual("<html><head><script><T</script></head><body></body></html>", d.ToString());
     d = HTML.Document.Parse("<head><style><T</style>");
     Assert.AreEqual("<html><head><style><T</style></head><body></body></html>", d.ToString());
 }
Exemplo n.º 8
0
 public void TestHTMLBOM()
 {
     HTML.Document d = HTML.Document.Parse("\uFEFFB");
     Assert.AreEqual("<html><head></head><body><p>B</p></body></html>", d.ToString());
 }
Exemplo n.º 9
0
 public void TestHTMLHead()
 {
     HTML.Document d = HTML.Document.Parse("<head><title>T<body>B");
     Assert.AreEqual("<html><head><title>T</title></head><body><p>B</p></body></html>", d.ToString());
     d = HTML.Document.Parse("<head><link rel='foo' href='bar'>");
     Assert.AreEqual("<html><head><link href=\"bar\" rel=\"foo\"></head><body></body></html>", d.ToString());
 }
Exemplo n.º 10
0
 public void TestHTMLSpaceTable()
 {
     HTML.Document d = HTML.Document.Parse("<table>\n <tr>\n  <td>a</td>\n  <td>b</td>\n <tr>\n  <td>c</td>\n</table>\n");
     Assert.AreEqual("<html><head></head><body><table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table></body></html>", d.ToString());
 }
Exemplo n.º 11
0
 public void TestHTMLTable()
 {
     HTML.Document d = HTML.Document.Parse("<table><tr><td>a</td><td>b</td><tr><td><p>c</td>");
     Assert.AreEqual("<html><head></head><body><table><tr><td>a</td><td>b</td></tr><tr><td><p>c</p></td></tr></table></body></html>", d.ToString());
     d = HTML.Document.Parse("<table><tr><td>a<caption>c</table>");
     Assert.AreEqual("<html><head></head><body><table><tr><td>a</td></tr><caption>c</caption></table></body></html>", d.ToString());
 }
Exemplo n.º 12
0
 public void TestHTMLExtraSlash()
 {
     HTML.Document d   = HTML.Document.Parse("<img src=\"http://imgs.xkcd.com/comics/voyager_1.png\" title=\"what'ever'\" />");
     HTML.Element  img = d.HTML.Follow("body.p.img");
     Assert.AreEqual(2, img.Attributes.Count);
     Assert.IsTrue(img.Attributes.ContainsKey("src"));
     Assert.AreEqual("http://imgs.xkcd.com/comics/voyager_1.png", img.Attributes["src"]);
     Assert.IsTrue(img.Attributes.ContainsKey("title"));
     Assert.AreEqual("what'ever'", img.Attributes["title"]);
     Assert.AreEqual("<html><head></head><body><p><img src=\"http://imgs.xkcd.com/comics/voyager_1.png\" title=\"what'ever'\"></p></body></html>", d.ToString());
 }