Skip to content

Commit

Permalink
Added test for styles
Browse files Browse the repository at this point in the history
  • Loading branch information
adamldavis committed Sep 30, 2016
1 parent 696f89c commit cac808a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/groovy/org/groocss/GroocssSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
}
}

}

0 comments on commit cac808a

Please sign in to comment.