[Sass] Test some unit-manipulation stuff, and the rgb function.

This commit is contained in:
Nathan Weizenbaum 2009-07-04 14:37:18 -07:00
parent fbb5ad9de4
commit 8486d6db56
3 changed files with 24 additions and 1 deletions

1
TODO
View File

@ -25,7 +25,6 @@
http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2
http://www.w3.org/TR/html5/syntax.html#attributes
** Sass
Add tests for ae4f319 and 4a901ed
[2.4] CSS superset
[2.4] Classes are mixins
Can refer to specific property values? Syntax?

View File

@ -88,6 +88,22 @@ class SassFunctionTest < Test::Unit::TestCase
assert_error_message("#aaaaaa is not a number for `abs'", "abs(#aaa)")
end
def test_rgb
assert_equal("#123456", evaluate("rgb(18, 52, 86)"))
assert_equal("#beaded", evaluate("rgb(190, 173, 237)"))
assert_error_message("Color value 256 must be between 0 and 255 inclusive for `rgb'",
"rgb(256, 1, 1)")
assert_error_message("Color value 256 must be between 0 and 255 inclusive for `rgb'",
"rgb(1, 256, 1)")
assert_error_message("Color value 256 must be between 0 and 255 inclusive for `rgb'",
"rgb(1, 1, 256)")
assert_error_message("Color value 256 must be between 0 and 255 inclusive for `rgb'",
"rgb(1, 256, 257)")
assert_error_message("Color value -1 must be between 0 and 255 inclusive for `rgb'",
"rgb(-1, 1, 1)")
end
private
def assert_rgb_hsl(rgb, hsl)

View File

@ -199,6 +199,14 @@ WARN
assert_equal "#81ff81", resolve("hsl(120, 100%, 75%) + #010001")
end
def test_operator_unit_conversion
assert_equal "1.1cm", resolve("1cm + 1mm")
assert_equal "true", resolve("2mm < 1cm")
assert_equal "true", resolve("10mm == 1cm")
assert_equal "true", resolve("1 == 1cm")
assert_equal "true", resolve("1.1cm == 11mm")
end
private
def resolve(str, opts = {}, environment = env)