Skip to content

Commit

Permalink
Merge pull request #268 from chungyc/justify-content
Browse files Browse the repository at this point in the history
Support `stretch` in `justify-content`.
  • Loading branch information
turion authored Oct 25, 2024
2 parents 7f646d4 + 0479d8d commit b9bb567
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions spec/Clay/FlexboxSpec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{-#LANGUAGE OverloadedStrings#-}

module Clay.FlexboxSpec where

import Clay.Common
import Clay.Flexbox
import Clay.Render
import Clay.Stylesheet

import Test.Hspec
import Data.Text.Lazy (Text)

compactRender :: Css -> Text
compactRender = renderWith compact []

spec :: Spec
spec = do
describe "justify-content" $ do
it "is inherit" $ do
(compactRender $ justifyContent inherit) `shouldBe` "{justify-content:inherit}"

it "is center" $ do
(compactRender $ justifyContent center) `shouldBe` "{justify-content:center}"

it "is flex-end" $ do
(compactRender $ justifyContent flexEnd) `shouldBe` "{justify-content:flex-end}"

it "is flex-start" $ do
(compactRender $ justifyContent flexStart) `shouldBe` "{justify-content:flex-start}"

it "is space-around" $ do
(compactRender $ justifyContent spaceAround) `shouldBe` "{justify-content:space-around}"

it "is space-between" $ do
(compactRender $ justifyContent spaceBetween) `shouldBe` "{justify-content:space-between}"

it "is space-evenly" $ do
(compactRender $ justifyContent spaceEvenly) `shouldBe` "{justify-content:space-evenly}"

it "is stretch" $ do
(compactRender $ justifyContent stretch) `shouldBe` "{justify-content:stretch}"

it "is other" $ do
(compactRender $ justifyContent $ other "random") `shouldBe` "{justify-content:random}"
2 changes: 1 addition & 1 deletion src/Clay/Flexbox.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ flexWrap = key "flex-wrap"

newtype JustifyContentValue = JustifyContentValue Value
deriving (Val, Other, Inherit, Center, FlexEnd
, FlexStart, SpaceAround, SpaceBetween, SpaceEvenly)
, FlexStart, SpaceAround, SpaceBetween, SpaceEvenly, Stretch)

justifyContent :: JustifyContentValue -> Css
justifyContent = key "justify-content"
Expand Down

0 comments on commit b9bb567

Please sign in to comment.