grass/tests/color_hwb.rs
Connor Skees ffaee04613
rewrite parsing, evaluation, and serialization (#67)
Adds support for the indented syntax, plain CSS imports, `@forward`, and many other previously missing features.
2022-12-26 15:33:04 -05:00

94 lines
2.8 KiB
Rust

#[macro_use]
mod macros;
test!(
blackness_black,
"@use \"sass:color\";\na {\n color: color.blackness(black);\n}\n",
"a {\n color: 100%;\n}\n"
);
test!(
blackness_white,
"@use \"sass:color\";\na {\n color: color.blackness(white);\n}\n",
"a {\n color: 0%;\n}\n"
);
test!(
blackness_approx_50_pct,
"@use \"sass:color\";\na {\n color: color.blackness(color.hwb(0, 0%, 50%));\n}\n",
"a {\n color: 49.8039215686%;\n}\n"
);
test!(
blackness_approx_50_pct_and_whiteness,
"@use \"sass:color\";\na {\n color: color.blackness(color.hwb(0, 50%, 50%));\n}\n",
"a {\n color: 49.8039215686%;\n}\n"
);
test!(
blackness_approx_70_pct_and_whiteness,
"@use \"sass:color\";\na {\n color: color.blackness(color.hwb(0, 70%, 70%));\n}\n",
"a {\n color: 49.8039215686%;\n}\n"
);
test!(
blackness_approx_half_pct,
"@use \"sass:color\";\na {\n color: color.blackness(color.hwb(0, 0%, 0.5%));\n}\n",
"a {\n color: 0.3921568627%;\n}\n"
);
test!(
hwb_half_blackness,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0%, 50%);\n}\n",
"a {\n color: maroon;\n}\n"
);
test!(
hwb_equal_white_black_50,
"@use \"sass:color\";\na {\n color: color.hwb(0, 50%, 50%);\n}\n",
"a {\n color: gray;\n}\n"
);
test!(
hwb_equal_white_black_70,
"@use \"sass:color\";\na {\n color: color.hwb(0, 70%, 70%);\n}\n",
"a {\n color: gray;\n}\n"
);
test!(
hwb_half_percent_black,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0%, 0.5%);\n}\n",
"a {\n color: #fe0000;\n}\n"
);
test!(
hwb_black_100,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0%, 100%);\n}\n",
"a {\n color: black;\n}\n"
);
test!(
blackness_named,
"@use \"sass:color\";\na {\n color: color.blackness($color: color.hwb(0, 0%, 42%));\n}\n",
"a {\n color: 41.9607843137%;\n}\n"
);
test!(
hwb_alpha_unitless,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0%, 100%, 0.04);\n}\n",
"a {\n color: rgba(0, 0, 0, 0.04);\n}\n"
);
test!(
hwb_alpha_unit_percent,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0%, 100%, 0.04%);\n}\n",
"a {\n color: rgba(0, 0, 0, 0.0004);\n}\n"
);
test!(
hwb_negative_alpha,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0%, 100%, -0.5);\n}\n",
"a {\n color: rgba(0, 0, 0, 0);\n}\n"
);
test!(
hue_60_whiteness_20_blackness_100,
"@use \"sass:color\";\na {\n color: color.hwb(60, 20%, 100%);\n}\n",
"a {\n color: #2b2b2b;\n}\n"
);
test!(
one_arg_with_slash,
"@use \"sass:color\";\na {\n color: color.hwb(180 30% 40% / 0);\n}\n",
"a {\n color: rgba(77, 153, 153, 0);\n}\n"
);
error!(
hwb_whiteness_missing_pct,
"@use \"sass:color\";\na {\n color: color.hwb(0, 0, 100);\n}\n",
"Error: $whiteness: Expected 0 to have unit \"%\"."
);