diff --git a/spec/Clay/MediaSpec.hs b/spec/Clay/MediaSpec.hs index ecffbe4..0cc353b 100644 --- a/spec/Clay/MediaSpec.hs +++ b/spec/Clay/MediaSpec.hs @@ -2,9 +2,9 @@ module Clay.MediaSpec (spec) where -import Clay (Css, em, query) +import Clay (compact, Css, em, opacity, query, renderWith) import Clay.Media -import Clay.Stylesheet (Feature, MediaType) +import Clay.Stylesheet (Feature, keyframes, MediaType) import Common import Data.Text.Lazy (Text, unpack) import Test.Hspec @@ -73,6 +73,15 @@ spec = do "prefers-color-scheme: light" `shouldRenderFromFeature` prefersColorScheme light "prefers-color-scheme: dark" `shouldRenderFromFeature` prefersColorScheme dark + describe "keyframes tests" $ do + it "keyframes test 1" $ + (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 emptyStyle = pure () diff --git a/src/Clay/Render.hs b/src/Clay/Render.hs index a855287..7adc1a8 100644 --- a/src/Clay/Render.hs +++ b/src/Clay/Render.hs @@ -16,7 +16,7 @@ import Control.Applicative import Control.Monad.Writer import Data.List (sort) import Data.Maybe -import Data.Text (Text, pack) +import Data.Text (Text) import Data.Text.Lazy.Builder import Prelude hiding ((**)) @@ -150,7 +150,7 @@ kframe cfg (Keyframes ident xs) = frame :: Config -> (Number, [Rule]) -> Builder frame cfg (p, rs) = mconcat - [ fromText (pack (show p)) + [ fromText (cssNumberText p) , "% " , rules cfg [] rs ]