HTML Reader: Tests for 'tt' and 'code' elements (#8330).

tt is a deprecated element in HTML, but is still used in the wild in
some places, support reading it as just another 'code' element.

Commit 4abb9d0ad8 was originally
part of this PR as well.
This commit is contained in:
Justin Wood
2022-09-28 14:04:07 -07:00
committed by John MacFarlane
parent 4abb9d0ad8
commit 740396d1ed
3 changed files with 18 additions and 1 deletions
+1 -1
View File
@@ -662,7 +662,7 @@ inline = pTagText <|> do
"img" -> pImage
"svg" -> pSvg
"bdo" -> pBdo
"tt" -> pCode
"tt" -> pCode
"code" -> pCode
"samp" -> pCodeWithClass "samp" "sample"
"var" -> pCodeWithClass "var" "variable"
+12
View File
@@ -98,6 +98,18 @@ tests = [ testGroup "base tag"
, test htmlNativeDivs "<main> followed by text" $ "<main>main content</main>non-main content" =?>
doc (divWith ("", [], [("role", "main")]) (plain (text "main content")) <> plain (text "non-main content"))
]
, testGroup "code"
[
test html "inline code block" $
"<code>Answer is 42</code>" =?>
plain (codeWith ("",[],[]) "Answer is 42")
]
, testGroup "tt"
[
test html "inline tt block" $
"<tt>Answer is 42</tt>" =?>
plain (codeWith ("",[],[]) "Answer is 42")
]
, testGroup "samp"
[
test html "inline samp block" $
+5
View File
@@ -84,6 +84,11 @@ tests =
doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
=?> "<q cite=\"http://example.org\">examples</q>"
]
, testGroup "code"
[ "code should be rendered correctly" =:
plain (codeWith ("",[],[]) "Answer is 42") =?>
"<code>Answer is 42</code>"
]
, testGroup "sample"
[ "sample should be rendered correctly" =:
plain (codeWith ("",["sample"],[]) "Answer is 42") =?>