| 1 |
# Disable sass cache |
| 2 |
local_disable_cache() |
| 3 |
|
| 4 |
body_rule <- "body { background-color: $color; color: my_invert($color); }" |
| 5 |
|
| 6 |
blue <- list(color = "blue !default") |
| 7 |
red <- list(color = "red !default") |
| 8 |
green <- list(color = "green !default") |
| 9 |
core <- sass_layer( |
| 10 |
defaults = blue, |
| 11 |
functions = "@function my_invert($color, $amount: 100%) { |
| 12 |
$inverse: change-color($color, $hue: hue($color) + 180); |
| 13 |
@return mix($inverse, $color, $amount); |
| 14 |
}", |
| 15 |
rules = body_rule |
| 16 |
) |
| 17 |
|
| 18 |
test_that("sass_layer is equivalent to sass", { |
| 19 |
expect_equal( |
| 20 |
sass(core), |
| 21 |
sass(list(blue, "body { background-color: $color; color: yellow; }")), |
| 22 |
ignore_attr = TRUE |
| 23 |
) |
| 24 |
}) |