summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-12-25 22:49:17 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-12-25 22:49:29 +0100
commit69ffbe03563cdbc7be6b826e2def2fc797442792 (patch)
tree3792ce42ee2e9983876f9177533201dd712b76d1 /tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
parent2ae11c9d7f3138fe9e8397059c641e1962ede197 (diff)
downloadhakyll-69ffbe03563cdbc7be6b826e2def2fc797442792.tar.gz
Add demoteHeaders, refactor a bit
Diffstat (limited to 'tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs')
-rw-r--r--tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs b/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
new file mode 100644
index 0000000..7799217
--- /dev/null
+++ b/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
@@ -0,0 +1,34 @@
+--------------------------------------------------------------------------------
+{-# 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\" />"
+ , "<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>"
+ ]