Skip to content

Commit

Permalink
[Color 4] Update tests for Color Level 4
Browse files Browse the repository at this point in the history
This updates most tests for the currently-implemented chunk of the
Color 4 feature. A few tests that need more thorough reworking (such
as being moved out of `error/` for things that are no longer intended
to be errors) are marked as "todo" instead.

See #1828
See sass/sass#2831
  • Loading branch information
nex3 committed Dec 7, 2022
1 parent 360a369 commit e78fedc
Show file tree
Hide file tree
Showing 87 changed files with 2,267 additions and 1,265 deletions.
2 changes: 1 addition & 1 deletion spec/core_functions/color/adjust_color/error/args.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Error: Only one positional argument is allowed. All other arguments must be pass
a {b: adjust-color(red, $ambience: 10%)}

<===> unknown/error
Error: No argument named $ambience.
Error: $ambience: Color space rgb doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $ambience: 10%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
11 changes: 11 additions & 0 deletions spec/core_functions/color/adjust_color/error/bounds.hrx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<===> README.md
According to the new color space spec, out-of-bounds values should be allowed
(and clamped for strictly bounded spaces). See sass/sass-spec#1828.

<===> options.yml
---
:todo:
- dart-sass

<===>
================================================================================
<===> red/too_low/input.scss
a {b: adjust-color(red, $red: -256)}

Expand Down
14 changes: 7 additions & 7 deletions spec/core_functions/color/adjust_color/error/mixed_formats.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a {b: adjust-color(red, $red: 1, $hue: 1)}

<===> red_and_hue/error
Error: RGB parameters may not be passed along with HSL parameters.
Error: $hue: Color space rgb doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $red: 1, $hue: 1)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -23,7 +23,7 @@ Error: Cannot specify HSL and RGB values for a color at the same time for `adjus
a {b: adjust-color(red, $green: 1, $saturation: 1%)}

<===> green_and_saturation/error
Error: RGB parameters may not be passed along with HSL parameters.
Error: $saturation: Color space rgb doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $green: 1, $saturation: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -44,7 +44,7 @@ Error: Cannot specify HSL and RGB values for a color at the same time for `adjus
a {b: adjust-color(red, $blue: 1, $lightness: 1%)}

<===> blue_and_lightness/error
Error: RGB parameters may not be passed along with HSL parameters.
Error: $lightness: Color space rgb doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $blue: 1, $lightness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -70,7 +70,7 @@ Error: Cannot specify HSL and RGB values for a color at the same time for `adjus
a {b: adjust-color(red, $red: 1, $blackness: 1%)}

<===> red_and_blackness/error
Error: RGB parameters may not be passed along with HWB parameters.
Error: $blackness: Color space rgb doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $red: 1, $blackness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -88,7 +88,7 @@ Error: RGB parameters may not be passed along with HWB parameters.
a {b: adjust-color(red, $green: 1, $whiteness: 1%)}

<===> green_and_whiteness/error
Error: RGB parameters may not be passed along with HWB parameters.
Error: $whiteness: Color space rgb doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $green: 1, $whiteness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -106,7 +106,7 @@ Error: RGB parameters may not be passed along with HWB parameters.
a {b: adjust-color(red, $saturation: 1%, $blackness: 1%)}

<===> saturation_and_blackness/error
Error: HSL parameters may not be passed along with HWB parameters.
Error: $blackness: Color space hsl doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $saturation: 1%, $blackness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -124,7 +124,7 @@ Error: HSL parameters may not be passed along with HWB parameters.
a {b: adjust-color(red, $lightness: 1%, $whiteness: 1%)}

<===> lightness_and_whiteness/error
Error: HSL parameters may not be passed along with HWB parameters.
Error: $whiteness: Color space hsl doesn't have a channel with this name.
,
1 | a {b: adjust-color(red, $lightness: 1%, $whiteness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
75 changes: 75 additions & 0 deletions spec/core_functions/color/adjust_color/hsl.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
a {b: adjust-color(red, $hue: 359)}

<===> hue/max/output.css
a {
b: rgb(255, 0, 4.25);
}

<===> hue/max/output-libsass.css
a {
b: #ff0004;
}
Expand Down Expand Up @@ -52,6 +57,11 @@ a {
a {b: adjust-color(red, $hue: 123)}

<===> hue/middle/output.css
a {
b: rgb(0, 255, 12.75);
}

<===> hue/middle/output-libsass.css
a {
b: #00ff0d;
}
Expand All @@ -62,6 +72,11 @@ a {
a {b: adjust-color(red, $hue: 0.5)}

<===> hue/fraction/output.css
a {
b: rgb(255, 2.125, 0);
}

<===> hue/fraction/output-libsass.css
a {
b: #ff0200;
}
Expand Down Expand Up @@ -102,6 +117,11 @@ a {
a {b: adjust-color(plum, $saturation: -100%)}

<===> saturation/min/output.css
a {
b: rgb(190.5, 190.5, 190.5);
}

<===> saturation/min/output-libsass.css
a {
b: #bfbfbf;
}
Expand All @@ -112,6 +132,11 @@ a {
a {b: adjust-color(plum, $saturation: -48%)}

<===> saturation/min_remaining/output.css
a {
b: rgb(190.5, 190.5, 190.5);
}

<===> saturation/min_remaining/output-libsass.css
a {
b: #bfbfbf;
}
Expand All @@ -122,6 +147,11 @@ a {
a {b: adjust-color(plum, $saturation: 14%)}

<===> saturation/high/output.css
a {
b: rgb(230.03, 150.97, 230.03);
}

<===> saturation/high/output-libsass.css
a {
b: #e697e6;
}
Expand All @@ -132,6 +162,11 @@ a {
a {b: adjust-color(plum, $saturation: -14%)}

<===> saturation/low/output.css
a {
b: rgb(211.97, 169.03, 211.97);
}

<===> saturation/low/output-libsass.css
a {
b: #d4a9d4;
}
Expand Down Expand Up @@ -172,6 +207,11 @@ a {
a {b: adjust-color(red, $lightness: 0.5%)}

<===> lightness/fraction/output.css
a {
b: rgb(255, 2.55, 2.55);
}

<===> lightness/fraction/output-libsass.css
a {
b: #ff0303;
}
Expand Down Expand Up @@ -202,6 +242,11 @@ a {
a {b: adjust-color(red, $lightness: 14%)}

<===> lightness/high/output.css
a {
b: rgb(255, 71.4, 71.4);
}

<===> lightness/high/output-libsass.css
a {
b: #ff4747;
}
Expand All @@ -212,6 +257,11 @@ a {
a {b: adjust-color(red, $lightness: -14%)}

<===> lightness/low/output.css
a {
b: rgb(183.6, 0, 0);
}

<===> lightness/low/output-libsass.css
a {
b: #b80000;
}
Expand All @@ -222,6 +272,11 @@ a {
a {b: adjust-color(black, $hue: 12, $saturation: 24%, $lightness: 48%)}

<===> all/output.css
a {
b: rgb(151.776, 104.7744, 93.024);
}

<===> all/output-libsass.css
a {
b: #98695d;
}
Expand All @@ -232,6 +287,11 @@ a {
a {b: adjust-color(rgba(black, 0.7), $hue: 12, $saturation: 24%, $lightness: 48%)}

<===> alpha_input/output.css
a {
b: rgba(151.776, 104.7744, 93.024, 0.7);
}

<===> alpha_input/output-libsass.css
a {
b: rgba(152, 105, 93, 0.7);
}
Expand All @@ -242,6 +302,11 @@ a {
a {b: adjust-color(black, $hue: 12, $saturation: 24%, $lightness: 48%, $alpha: -0.7)}

<===> alpha_arg/output.css
a {
b: rgba(151.776, 104.7744, 93.024, 0.3);
}

<===> alpha_arg/output-libsass.css
a {
b: rgba(152, 105, 93, 0.3);
}
Expand All @@ -253,6 +318,11 @@ a {
a {b: adjust-color(black, $hue: 12, $saturation: 24%, $lightness: 48%, $alpha: 0.7)}

<===> alpha_arg_above_max/output.css
a {
b: rgb(151.776, 104.7744, 93.024);
}

<===> alpha_arg_above_max/output-libsass.css
a {
b: #98695d;
}
Expand All @@ -263,6 +333,11 @@ a {
a {b: adjust-color($color: black, $hue: 12, $saturation: 24%, $lightness: 48%)}

<===> named/output.css
a {
b: rgb(151.776, 104.7744, 93.024);
}

<===> named/output-libsass.css
a {
b: #98695d;
}
8 changes: 4 additions & 4 deletions spec/core_functions/color/adjust_color/hwb.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ a {b: adjust-color(#cc6666, $whiteness: 100%)}

<===> whiteness/max/output.css
a {
b: #d5d5d5;
b: rgb(212.5, 212.5, 212.5);
}

<===>
Expand All @@ -20,7 +20,7 @@ a {b: adjust-color(#cc6666, $whiteness: 60%)}

<===> whiteness/max_remaining/output.css
a {
b: #d5d5d5;
b: rgb(212.5, 212.5, 212.5);
}

<===>
Expand Down Expand Up @@ -80,7 +80,7 @@ a {b: adjust-color(#993333, $blackness: 100%)}

<===> blackness/max/output.css
a {
b: #2b2b2b;
b: rgb(42.5, 42.5, 42.5);
}

<===>
Expand All @@ -90,7 +90,7 @@ a {b: adjust-color(#993333, $blackness: 60%)}

<===> blackness/max_remaining/output.css
a {
b: #2b2b2b;
b: rgb(42.5, 42.5, 42.5);
}

<===>
Expand Down
21 changes: 20 additions & 1 deletion spec/core_functions/color/adjust_color/units.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ a {b: adjust-color(red, $hue: 60rad)}

<===> hue/angle/output.css
a {
b: #00b4ff;
b: rgb(0, 179.576224164, 255);
}

<===>
Expand All @@ -66,6 +66,11 @@ a {
a {b: adjust-color(red, $saturation: -10%)}

<===> saturation/percent/output.css
a {
b: rgb(242.25, 12.75, 12.75);
}

<===> saturation/percent/output-libsass.css
a {
b: #f20d0d;
}
Expand All @@ -76,6 +81,11 @@ a {
a {b: adjust-color(red, $saturation: -10)}

<===> saturation/unitless/output.css
a {
b: rgb(242.25, 12.75, 12.75);
}

<===> saturation/unitless/output-libsass.css
a {
b: #f20d0d;
}
Expand All @@ -93,12 +103,19 @@ More info: https://sass-lang.com/d/function-units
'
input.scss 1:7 root stylesheet

<===> saturation/unitless/warning-libsass

<===>
================================================================================
<===> saturation/unknown/input.scss
a {b: adjust-color(red, $saturation: -10in)}

<===> saturation/unknown/output.css
a {
b: rgb(242.25, 12.75, 12.75);
}

<===> saturation/unknown/output-libsass.css
a {
b: #f20d0d;
}
Expand All @@ -116,6 +133,8 @@ More info: https://sass-lang.com/d/function-units
'
input.scss 1:7 root stylesheet

<===> saturation/unknown/warning-libsass

<===>
================================================================================
<===> lightness/percent/input.scss
Expand Down
Loading

0 comments on commit e78fedc

Please sign in to comment.