summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Web/CompressCss/Tests.hs
blob: 1430abffdb145f96e359ce693432c0be3970568e (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
38
39
40
41
42
43
--------------------------------------------------------------------------------
module Hakyll.Web.CompressCss.Tests
    ( tests
    ) where


--------------------------------------------------------------------------------
import           Data.Char       (toUpper)
import           Test.Framework  (Test, testGroup)
import           Test.HUnit      (assert, (@=?))


--------------------------------------------------------------------------------
import           Hakyll.Web.CompressCss
import           TestSuite.Util


--------------------------------------------------------------------------------
tests :: Test
tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat
    [ fromAssertions "compressCss"
        [ 
          -- compress whitespace
          " something something " @=?
            compressCss " something  \n\t\r  something "

          -- strip comments
        , "" @=?
            compressCss "/* abc { } ;; \n\t\r */"

          -- compress separators
        , "}" @=?
            compressCss ";   }"
        , "{};" @=?
            compressCss "  {  }  ;  "
        , ";" @=?
            compressCss ";;;;;;;"

          -- some real-life css
        , "a:after{content: \" (\" attr(href) \")\"}" @=?
            compressCss "a:after {  content: \" (\" attr(href) \")\"; }"
        ]
    ]