-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
164 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Test.StyleSpec (spec) where | ||
|
||
import Data.Map qualified as M | ||
import Skeletest | ||
import Web.View | ||
import Web.View.Style ((-.)) | ||
import Web.View.Types (Attributes (..), Class (..), selector) | ||
import Prelude hiding (span) | ||
|
||
|
||
spec :: Spec | ||
spec = do | ||
describe "Style Class" $ do | ||
it "should compile, and set both the className and styles" $ do | ||
let as = list Decimal mempty | ||
length (M.elems as.classes) `shouldBe` 1 | ||
[c] <- pure $ M.elems as.classes | ||
c.selector `shouldBe` selector "list-decimal" | ||
c.properties `shouldBe` M.fromList [("list-style-type", "decimal")] | ||
|
||
it "should work with outside member None" $ do | ||
let as = list None mempty | ||
length (M.elems as.classes) `shouldBe` 1 | ||
[c] <- pure $ M.elems as.classes | ||
c.selector `shouldBe` selector "list-none" | ||
c.properties `shouldBe` M.fromList [("list-style-type", "none")] | ||
|
||
describe "ToClassName" $ do | ||
it "should hyphenate classnames" $ do | ||
"woot" -. None `shouldBe` "woot-none" | ||
it "should not hyphenate with empty suffix" $ do | ||
"woot" -. () `shouldBe` "woot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters