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