Skip to content

Commit

Permalink
Use compact renderer for test
Browse files Browse the repository at this point in the history
  • Loading branch information
ddssff committed Nov 11, 2023
1 parent e5c4866 commit 70f2947
Showing 1 changed file with 7 additions and 40 deletions.
47 changes: 7 additions & 40 deletions spec/Clay/MediaSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Clay.MediaSpec (spec) where

import Clay (Css, em, hidden, pretty, query, renderWith, visible, visibility)
import Clay (compact, Css, em, hidden, opacity, query, renderWith)

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.4.4 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.6.5 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.8.4 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.10.7 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.0.2 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2.2 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant

Check warning on line 5 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4.2 cabal

The import of ‘hidden’ from module ‘Clay’ is redundant
import Clay.Media
import Clay.Render (Config(..))

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.4.4 cabal

The import of ‘Clay.Render’ is redundant

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.6.5 cabal

The import of ‘Clay.Render’ is redundant

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.8.4 cabal

The import of ‘Clay.Render’ is redundant

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.10.7 cabal

The import of ‘Clay.Render’ is redundant

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.0.2 cabal

The import of ‘Clay.Render’ is redundant

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2.2 cabal

The import of ‘Clay.Render’ is redundant

Check warning on line 7 in spec/Clay/MediaSpec.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4.2 cabal

The import of ‘Clay.Render’ is redundant
import Clay.Stylesheet (Feature, keyframes, MediaType)
Expand Down Expand Up @@ -76,45 +76,12 @@ spec = do

describe "keyframes tests" $ do
it "keyframes test 1" $
(renderWith custom [] $ keyframes "blink-animation" [(0, visibility visible), (100, visibility hidden)])
`shouldBe` (Text.unlines
[ ""
, "@-webkit-keyframes blink-animation", "{"
-- without fix for the rendering of the Clay.Property.Number type:
-- , "Number {unNumber = 0.00000}% ", "{", "visibility:visible;", "}", ""
-- , "Number {unNumber = 100.00000}% ", "{", "visibility:hidden;", "}", ""
, "0% ", "{", "visibility:visible;", "}", ""
, "100% ", "{", "visibility:hidden;", "}", "", "}"
, ""
, "@-moz-keyframes blink-animation", "{"
, "0% ", "{", "visibility:visible;", "}", ""
, "100% ", "{", "visibility:hidden;", "}", "", "}"
, ""
, "@-ms-keyframes blink-animation", "{"
, "0% ", "{", "visibility:visible;", "}", ""
, "100% ", "{", "visibility:hidden;", "}", "", "}"
, ""
, "@-o-keyframes blink-animation", "{"
, "0% ", "{", "visibility:visible;", "}", ""
, "100% ", "{", "visibility:hidden;", "}", "", "}"
, ""
, "@keyframes blink-animation", "{"
, "0% ", "{", "visibility:visible;", "}", ""
, "100% ", "{", "visibility:hidden;", "}", "", "}"
, ""])

custom =
pretty
{
indentation = ""
-- newline = "\n"
, sep = ""
-- , finalSemicolon = True -- False
, warn = False
, align = False
, banner = False
, comments = False
}
(renderWith compact [] $ keyframes "blink-animation" [(0, opacity 0), (100, opacity 1)])
`shouldBe` ("@-webkit-keyframes blink-animation{0% {opacity:0}100% {opacity:1}}" <>
"@-moz-keyframes blink-animation{0% {opacity:0}100% {opacity:1}}" <>
"@-ms-keyframes blink-animation{0% {opacity:0}100% {opacity:1}}" <>
"@-o-keyframes blink-animation{0% {opacity:0}100% {opacity:1}}" <>
"@keyframes blink-animation{0% {opacity:0}100% {opacity:1}}")

-- | Empty CSS for when CSS is needed but we don't care about it.
emptyStyle :: Css
Expand Down

0 comments on commit 70f2947

Please sign in to comment.