Skip to content

Commit b0ba090

Browse files
authored
Merge pull request #57 from siegfriedweber/quote-fontfaceformat
FontFaceFormat put in quotes
2 parents 08a04d5 + 72f6071 commit b0ba090

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/CSS/FontFace.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ derive instance ordFontFaceSrc :: Ord FontFaceSrc
4242
derive instance genericFontFaceSrc :: Generic FontFaceSrc
4343

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

4848
fontFaceSrc :: NonEmpty Array FontFaceSrc -> CSS

test/Main.purs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import Prelude
44

55
import Control.Monad.Eff (Eff)
66
import Control.Monad.Eff.Exception (EXCEPTION, error, throwException)
7-
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, (?))
7+
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)
88
import Data.Maybe (Maybe(..))
9+
import Data.NonEmpty (singleton)
910

1011
example1 :: Rendered
1112
example1 = render do
@@ -32,6 +33,10 @@ example5 = render do
3233
boxSizing contentBox
3334
boxSizing borderBox
3435

36+
example6 :: Rendered
37+
example6 = render do
38+
fontFaceSrc $ singleton $ FontFaceSrcUrl "font.woff" $ Just WOFF
39+
3540
nestedNodes :: Rendered
3641
nestedNodes = render do
3742
fromString "#parent" ? do
@@ -63,3 +68,5 @@ main = do
6368
renderedSheet nestedNodes `assertEqual` Just "#parent { display: block }\n#parent #child { display: block }\n"
6469

6570
renderedSheet nestedNodesWithEmptyParent `assertEqual` Just "#parent #child { display: block }\n"
71+
72+
renderedInline example6 `assertEqual` Just "src: url(\"font.woff\") format(\"woff\")"

0 commit comments

Comments
 (0)