Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering of the Number type #256

Merged
merged 7 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions spec/Clay/MediaSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

module Clay.MediaSpec (spec) where

import Clay (Css, em, query)
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 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 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
turion marked this conversation as resolved.
Show resolved Hide resolved
import Clay.Media
import Clay.Stylesheet (Feature, MediaType)
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 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 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
turion marked this conversation as resolved.
Show resolved Hide resolved
import Clay.Stylesheet (Feature, keyframes, MediaType)
import Common
import Data.Text.Lazy (Text, unpack)
import Data.Text.Lazy as Text (Text, toStrict, unlines, unpack)

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

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.4.4 cabal

The import of ‘toStrict, Text.unlines’

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

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.6.5 cabal

The import of ‘toStrict, unlines’

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

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.0.2 cabal

The import of ‘toStrict, unlines’

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

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.8.4 cabal

The import of ‘toStrict, unlines’

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

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.10.7 cabal

The import of ‘toStrict, unlines’
turion marked this conversation as resolved.
Show resolved Hide resolved
import Test.Hspec
import Prelude hiding (all, print)

Expand Down Expand Up @@ -73,6 +74,15 @@
"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 ()
Expand Down
2 changes: 1 addition & 1 deletion src/Clay/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import Control.Monad.Writer
import Data.List (sort)
import Data.Maybe
import Data.Text (Text, pack)

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.4.4 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.4.4 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2.2 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2.2 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.6.5 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.6.5 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.0.2 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.0.2 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.8.4 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.8.4 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4.2 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4.2 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.10.7 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant

Check warning on line 19 in src/Clay/Render.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 8.10.7 cabal

The import of ‘pack’ from module ‘Data.Text’ is redundant
import Data.Text.Lazy.Builder
import Prelude hiding ((**))

Expand Down Expand Up @@ -150,7 +150,7 @@
frame :: Config -> (Number, [Rule]) -> Builder
frame cfg (p, rs) =
mconcat
[ fromText (pack (show p))
[ fromText (cssNumberText p)
turion marked this conversation as resolved.
Show resolved Hide resolved
, "% "
, rules cfg [] rs
]
Expand Down
Loading