]
-let ``Can parse code blocks``() =
- let html = "\r\n let f a b = a * b\r\n f 5 6 |> should equal 30
"
+let ``Can parse pre containing code blocks``() =
+ let html = "\r\n let f a b = a * b\r\n f 5 6 |> should equal 30
"
let result =
(HtmlDocument.Parse html)
@@ -815,6 +816,33 @@ let ``Can parse code blocks``() =
|> Seq.toList
result |> should equal [ "\r\n let f a b = a * b\r\n f 5 6 |> should equal 30" ]
+[]
+let ``Can parse pre blocks with char refs``() =
+ let html = "let hello =\r\n fun who ->\r\n "hello" + who
"
+
+ let result =
+ (HtmlDocument.Parse html)
+ |> HtmlDocument.descendantsNamed true [ "pre" ]
+ |> Seq.head
+ |> HtmlNode.innerText
+ let expected = "let hello =\r\n fun who ->\r\n \"hello\" + who"
+ result |> should equal expected
+
+[]
+let ``Drops whitespace outside pre``() =
+ let html =
+ ""
+
+ let result =
+ (HtmlDocument.Parse html)
+ |> HtmlDocument.descendantsNamed false [ "div" ]
+ |> Seq.head
+ |> string
+ // default indentation is 2 spaces
+ let nl = Environment.NewLine
+ let expected = $""
+ result |> should equal expected
+
[]
let ``Can parse national rail mobile site correctly``() =
HtmlDocument.Load "Data/UKDepartures.html"
@@ -911,9 +939,9 @@ let ``Parsing non-html content doesn't cause an infinite loop - Github-1264``()
[]
let ``Can handle incomplete tags at end of file without creating an infinite loop``() =
let result = HtmlDocument.Parse """ should equal expected
\ No newline at end of file
+ result |> should equal expected