From cac808a26730180715e451ad1fd590818b72b2db Mon Sep 17 00:00:00 2001 From: Adam Davis Date: Fri, 30 Sep 2016 14:15:46 -0400 Subject: [PATCH] Added test for styles --- src/test/groovy/org/groocss/GroocssSpec.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/groovy/org/groocss/GroocssSpec.groovy b/src/test/groovy/org/groocss/GroocssSpec.groovy index 90c8c83..8a6045e 100644 --- a/src/test/groovy/org/groocss/GroocssSpec.groovy +++ b/src/test/groovy/org/groocss/GroocssSpec.groovy @@ -1001,4 +1001,16 @@ class GroocssSpec extends Specification { } } + def "should use a condition to add styles"() { + expect: + GrooCSS.process { + def mycolor = { alpha -> styles { + if (alpha == 0) color '#123' + else color rgba(0, 0, 0, alpha) + }} + assert mycolor(0).styleList[0] == new Style('color', '#123') + assert mycolor(0.5).styleList[0]==new Style('color', 'rgba(0, 0, 0, 0.50)') + } + } + }