Skip to content

Commit e5beb6b

Browse files
authored
Fix cubic-bezier rendering (#109)
1 parent f2f56e2 commit e5beb6b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/CSS/Transition.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ instance valTimingFunction :: Val TimingFunction where
4040
value StepStart = fromString "step-start"
4141
value StepEnd = fromString "step-end"
4242
value (Steps n v) = fromString "steps(" <> value [fromString $ show n, value v] <> fromString ")"
43-
value (CubicBezier a b c d) = fromString "cubic-bezier(" <> value (a ! b ! c ! d) <> fromString ")"
43+
value (CubicBezier a b c d) = fromString "cubic-bezier(" <> value [a, b, c, d] <> fromString ")"
4444

4545
ease :: TimingFunction
4646
ease = Ease

test/Main.purs

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

55
import Effect (Effect)
66
import Effect.Exception (error, throwException)
7-
import CSS (Rendered, Path(..), Predicate(..), Refinement(..), Selector(..), FontFaceSrc(..), FontFaceFormat(..), renderedSheet, renderedInline, fromString, selector, block, display, render, borderBox, boxSizing, contentBox, blue, color, body, a, p, px, dashed, border, inlineBlock, red, (?), (&), (|>), (|*), (|+), byId, byClass, (@=), (^=), ($=), (*=), (~=), (|=), hover, fontFaceSrc, fontStyle, deg, zIndex, textOverflow, opacity, transform, transition, easeInOut, ms)
7+
import CSS (Rendered, Path(..), Predicate(..), Refinement(..), Selector(..), FontFaceSrc(..), FontFaceFormat(..), renderedSheet, renderedInline, fromString, selector, block, display, render, borderBox, boxSizing, contentBox, blue, color, body, a, p, px, dashed, border, inlineBlock, red, (?), (&), (|>), (|*), (|+), byId, byClass, (@=), (^=), ($=), (*=), (~=), (|=), hover, fontFaceSrc, fontStyle, deg, zIndex, textOverflow, opacity, transform, transition, easeInOut, cubicBezier, ms)
88
import CSS.FontStyle as FontStyle
99
import CSS.Text.Overflow as TextOverflow
1010
import CSS.Transform as Transform
@@ -141,6 +141,10 @@ transition1 :: Rendered
141141
transition1 = render do
142142
transition "background-color" (ms 1.0) easeInOut (ms 0.0)
143143

144+
transition2 :: Rendered
145+
transition2 = render do
146+
transition "background-color" (ms 1.0) (cubicBezier 0.3 0.3 0.7 1.4) (ms 0.0)
147+
144148
assertEqual :: forall a. Eq a => Show a => a -> a -> Effect Unit
145149
assertEqual x y = unless (x == y) <<< throwException <<< error $ "Assertion failed: " <> show x <> " /= " <> show y
146150

@@ -190,3 +194,4 @@ main = do
190194
renderedInline scaleTransform2 `assertEqual` Just "transform: scale(0.2, 0.8)"
191195

192196
renderedInline transition1 `assertEqual` Just "-webkit-transition: background-color 1.0ms ease-in-out 0.0ms; -moz-transition: background-color 1.0ms ease-in-out 0.0ms; -ms-transition: background-color 1.0ms ease-in-out 0.0ms; -o-transition: background-color 1.0ms ease-in-out 0.0ms; transition: background-color 1.0ms ease-in-out 0.0ms"
197+
renderedInline transition2 `assertEqual` Just "-webkit-transition: background-color 1.0ms cubic-bezier(0.3, 0.3, 0.7, 1.4) 0.0ms; -moz-transition: background-color 1.0ms cubic-bezier(0.3, 0.3, 0.7, 1.4) 0.0ms; -ms-transition: background-color 1.0ms cubic-bezier(0.3, 0.3, 0.7, 1.4) 0.0ms; -o-transition: background-color 1.0ms cubic-bezier(0.3, 0.3, 0.7, 1.4) 0.0ms; transition: background-color 1.0ms cubic-bezier(0.3, 0.3, 0.7, 1.4) 0.0ms"

0 commit comments

Comments
 (0)