git.iko.soy/typeable/pandoc
on 34412cf help sign in
32 lines 1.6 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module Tests.Readers.HTML (tests) where
4import Test.Tasty
5import Tests.Helpers
6import Text.Pandoc
7import Text.Pandoc.Arbitrary ()
8import Text.Pandoc.Builder
10html :: String -> Pandoc
11html = purely $ readHtml def
13tests :: [TestTree]
14tests = [ testGroup "base tag"
15 [ test html "simple" $
16 "<head><base href=\"http://www.w3schools.com/images/foo\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
17 plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
18 , test html "slash at end of base" $
19 "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
20 plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
21 , test html "slash at beginning of href" $
22 "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"/stickman.gif\" alt=\"Stickman\"></head>" =?>
23 plain (image "http://www.w3schools.com/stickman.gif" "" (text "Stickman"))
24 , test html "absolute URL" $
25 "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"http://example.com/stickman.gif\" alt=\"Stickman\"></head>" =?>
26 plain (image "http://example.com/stickman.gif" "" (text "Stickman"))
27 ]
28 , testGroup "anchors"
29 [ test html "anchor without href" $ "<a name=\"anchor\"/>" =?>
30 plain (spanWith ("anchor",[],[]) mempty)
31 ]
32 ]