summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
blob: 4d9421ecfd9ba8a98ae277811460528b189c35cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
module Hakyll.Web.Html.RelativizeUrls.Tests
    ( tests
    ) where


--------------------------------------------------------------------------------
import           Test.Framework                 (Test, testGroup)
import           Test.HUnit                     ((@=?))

--------------------------------------------------------------------------------
import           Hakyll.Web.Html.RelativizeUrls
import           TestSuite.Util


--------------------------------------------------------------------------------
tests :: Test
tests = testGroup "Hakyll.Web.Html.RelativizeUrls.Tests" $
    fromAssertions "relativizeUrls"
        [ "<a href=\"../foo\">bar</a>" @=?
            relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>"
        , "<img src=\"../../images/lolcat.png\" />" @=?
            relativizeUrlsWith "../.." "<img src=\"/images/lolcat.png\" />"
        , "<video poster=\"../../images/lolcat.png\"></video>" @=?
            relativizeUrlsWith "../.."
                "<video poster=\"/images/lolcat.png\"></video>"
        , "<a href=\"http://haskell.org\">Haskell</a>" @=?
            relativizeUrlsWith "../.."
                "<a href=\"http://haskell.org\">Haskell</a>"
        , "<a href=\"http://haskell.org\">Haskell</a>" @=?
            relativizeUrlsWith "../.."
                "<a href=\"http://haskell.org\">Haskell</a>"
        , "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>" @=?
            relativizeUrlsWith "../.."
                "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>"
        ]