| 1 |
-------------------------------------------------------------------------------- |
| 2 |
{-# LANGUAGE OverloadedStrings #-} |
| 3 |
module Hakyll.Web.Html.RelativizeUrls.Tests |
| 4 |
( tests |
| 5 |
) where |
| 6 |
|
| 7 |
|
| 8 |
-------------------------------------------------------------------------------- |
| 9 |
import Test.Tasty (TestTree, testGroup) |
| 10 |
import Test.Tasty.HUnit ((@=?)) |
| 11 |
|
| 12 |
|
| 13 |
-------------------------------------------------------------------------------- |
| 14 |
import Hakyll.Web.Html.RelativizeUrls |
| 15 |
import TestSuite.Util |
| 16 |
|
| 17 |
|
| 18 |
-------------------------------------------------------------------------------- |
| 19 |
tests :: TestTree |
| 20 |
tests = testGroup "Hakyll.Web.Html.RelativizeUrls.Tests" $ |
| 21 |
fromAssertions "relativizeUrls" |
| 22 |
[ "<a href=\"../foo\">bar</a>" @=? |
| 23 |
relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>" |
| 24 |
, "<img src=\"../../images/lolcat.png\" />" @=? |
| 25 |
relativizeUrlsWith "../.." "<img src=\"/images/lolcat.png\" />" |
| 26 |
, "<video poster=\"../../images/lolcat.png\"></video>" @=? |
| 27 |
relativizeUrlsWith "../.." |
| 28 |
"<video poster=\"/images/lolcat.png\"></video>" |
| 29 |
, "<a href=\"http://haskell.org\">Haskell</a>" @=? |
| 30 |
relativizeUrlsWith "../.." |
| 31 |
"<a href=\"http://haskell.org\">Haskell</a>" |
| 32 |
, "<a href=\"http://haskell.org\">Haskell</a>" @=? |
| 33 |
relativizeUrlsWith "../.." |
| 34 |
"<a href=\"http://haskell.org\">Haskell</a>" |
| 35 |
, "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>" @=? |
| 36 |
relativizeUrlsWith "../.." |
| 37 |
"<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>" |
| 38 |
, "<img srcset=\"./image.png 200w, ./image2.png 400w\" />" @=? |
| 39 |
relativizeUrlsWith "." "<img srcset=\"/image.png 200w, /image2.png 400w\" />" |
| 40 |
] |