Skip to content

FontFaceFormat put in quotes #57

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

Merged
merged 1 commit into from
Feb 6, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/CSS/FontFace.purs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ derive instance ordFontFaceSrc :: Ord FontFaceSrc
derive instance genericFontFaceSrc :: Generic FontFaceSrc

instance valFontFaceSrc :: Val FontFaceSrc where
value (FontFaceSrcUrl u f) = fromString $ "url(" <> quote u <> ")" <> maybe "" (\f' -> " format(" <> formatName f' <> ")") f
value (FontFaceSrcUrl u f) = fromString $ "url(" <> quote u <> ")" <> maybe "" (\f' -> " format(" <> quote (formatName f') <> ")") f
value (FontFaceSrcLocal l) = fromString $ "local(" <> quote l <> ")"

fontFaceSrc :: NonEmpty Array FontFaceSrc -> CSS
Expand Down
9 changes: 8 additions & 1 deletion test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import Prelude

import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Exception (EXCEPTION, error, throwException)
import CSS (Rendered, Path(..), Predicate(..), Refinement(..), Selector(..), renderedSheet, renderedInline, fromString, selector, block, display, render, borderBox, boxSizing, contentBox, blue, color, body, px, dashed, border, inlineBlock, red, (?))
import CSS (Rendered, Path(..), Predicate(..), Refinement(..), Selector(..), FontFaceSrc(..), FontFaceFormat(..), renderedSheet, renderedInline, fromString, selector, block, display, render, borderBox, boxSizing, contentBox, blue, color, body, px, dashed, border, inlineBlock, red, (?), fontFaceSrc)
import Data.Maybe (Maybe(..))
import Data.NonEmpty (singleton)

example1 :: Rendered
example1 = render do
Expand All @@ -32,6 +33,10 @@ example5 = render do
boxSizing contentBox
boxSizing borderBox

example6 :: Rendered
example6 = render do
fontFaceSrc $ singleton $ FontFaceSrcUrl "font.woff" $ Just WOFF

nestedNodes :: Rendered
nestedNodes = render do
fromString "#parent" ? do
Expand Down Expand Up @@ -63,3 +68,5 @@ main = do
renderedSheet nestedNodes `assertEqual` Just "#parent { display: block }\n#parent #child { display: block }\n"

renderedSheet nestedNodesWithEmptyParent `assertEqual` Just "#parent #child { display: block }\n"

renderedInline example6 `assertEqual` Just "src: url(\"font.woff\") format(\"woff\")"