summaryrefslogtreecommitdiff
path: root/test/Tests
diff options
context:
space:
mode:
authorJustin Wood <jwood@starry.com>2022-09-28 11:20:53 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2022-09-28 14:04:07 -0700
commit740396d1ed91d03534b99ad8ccf545d916ee3f7a (patch)
treed08f2aa497cc52cf2bcadb93fa6901cf200957b5 /test/Tests
parent4abb9d0ad8dbb88fbc443a78d5a1b116cb7a5816 (diff)
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 4abb9d0ad8dbb88fbc443a78d5a1b116cb7a5816 was originally part of this PR as well.
Diffstat (limited to 'test/Tests')
-rw-r--r--test/Tests/Readers/HTML.hs12
-rw-r--r--test/Tests/Writers/HTML.hs5
2 files changed, 17 insertions, 0 deletions
diff --git a/test/Tests/Readers/HTML.hs b/test/Tests/Readers/HTML.hs
index eec5da643..b1d847354 100644
--- a/test/Tests/Readers/HTML.hs
+++ b/test/Tests/Readers/HTML.hs
@@ -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" $
diff --git a/test/Tests/Writers/HTML.hs b/test/Tests/Writers/HTML.hs
index 5176af1f0..3ec7a866d 100644
--- a/test/Tests/Writers/HTML.hs
+++ b/test/Tests/Writers/HTML.hs
@@ -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") =?>