From e4b47c0f241f58a1f958987c5d6cd7787f00a713 Mon Sep 17 00:00:00 2001 From: Vasiliy Yorkin Date: Tue, 31 Jul 2018 01:41:03 +0300 Subject: [PATCH] Fix cubic-bezier rendering --- src/CSS/Transition.purs | 2 +- test/Main.purs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/CSS/Transition.purs b/src/CSS/Transition.purs index 75965e2..9a01798 100644 --- a/src/CSS/Transition.purs +++ b/src/CSS/Transition.purs @@ -40,7 +40,7 @@ instance valTimingFunction :: Val TimingFunction where value StepStart = fromString "step-start" value StepEnd = fromString "step-end" value (Steps n v) = fromString "steps(" <> value [fromString $ show n, value v] <> fromString ")" - value (CubicBezier a b c d) = fromString "cubic-bezier(" <> value (a ! b ! c ! d) <> fromString ")" + value (CubicBezier a b c d) = fromString "cubic-bezier(" <> value [a, b, c, d] <> fromString ")" ease :: TimingFunction ease = Ease diff --git a/test/Main.purs b/test/Main.purs index 5ece715..bf2f010 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -4,7 +4,7 @@ import Prelude import Effect (Effect) import Effect.Exception (error, throwException) -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) +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) import CSS.FontStyle as FontStyle import CSS.Text.Overflow as TextOverflow import CSS.Transform as Transform @@ -141,6 +141,10 @@ transition1 :: Rendered transition1 = render do transition "background-color" (ms 1.0) easeInOut (ms 0.0) +transition2 :: Rendered +transition2 = render do + transition "background-color" (ms 1.0) (cubicBezier 0.3 0.3 0.7 1.4) (ms 0.0) + assertEqual :: forall a. Eq a => Show a => a -> a -> Effect Unit assertEqual x y = unless (x == y) <<< throwException <<< error $ "Assertion failed: " <> show x <> " /= " <> show y @@ -190,3 +194,4 @@ main = do renderedInline scaleTransform2 `assertEqual` Just "transform: scale(0.2, 0.8)" 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" + 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"