Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Color 4] Add tests to match updated spec #1995

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions spec/core_functions/color/adjust/error/missing.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<===> legacy/input.scss
@use 'sass:color';
a {b: color.adjust(rgb(none 0 0), $red: 10)}

<===> legacy/error
Error: $red: Because the CSS working group is still deciding on the best behavior, Sass doesn't currently support modifying missing channels (color: rgb(none 0 0)).
,
2 | a {b: color.adjust(rgb(none 0 0), $red: 10)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> modern/input.scss
@use 'sass:color';
a {b: color.adjust(lab(none 0 0), $lightness: 10%)}

<===> modern/error
Error: $lightness: Because the CSS working group is still deciding on the best behavior, Sass doesn't currently support modifying missing channels (color: lab(none 0 0)).
,
2 | a {b: color.adjust(lab(none 0 0), $lightness: 10%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> powerless/legacy/input.scss
@use 'sass:color';
a {b: color.adjust(grey, $hue: 10deg, $space: hsl)}

<===> powerless/legacy/error
Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn't currently support modifying missing channels (color: hsl(none 0% 50.1960784314%)).
,
2 | a {b: color.adjust(grey, $hue: 10deg, $space: hsl)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> powerless/modern/input.scss
@use 'sass:color';
a {b: color.adjust(grey, $hue: 10deg, $space: lch)}

<===> powerless/modern/error
Error: $hue: Because the CSS working group is still deciding on the best behavior, Sass doesn't currently support modifying missing channels (color: lch(53.5850134522% 0 none)).
,
2 | a {b: color.adjust(grey, $hue: 10deg, $space: lch)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> alpha/input.scss
@use 'sass:color';
a {b: color.adjust(rgb(0 0 0 / none), $alpha: 0.1)}

<===> alpha/error
Error: $alpha: Because the CSS working group is still deciding on the best behavior, Sass doesn't currently support modifying missing channels (color: rgb(0 0 0 / none)).
,
2 | a {b: color.adjust(rgb(0 0 0 / none), $alpha: 0.1)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet
147 changes: 145 additions & 2 deletions spec/core_functions/color/adjust/space.hrx
Original file line number Diff line number Diff line change
@@ -1,8 +1,151 @@
<===> input.scss
<===> identical/input.scss
@use 'sass:color';
a {b: color.adjust(oklch(50% 0.2 0deg), $space: lab)}

<===> identical/output.css
a {
b: oklch(50% 0.2 0deg);
}

<===>
================================================================================
<===> legacy/to_legacy/input.scss
@use 'sass:color';
a {b: color.adjust(pink, $saturation: -5%, $space: hsl)}

<===> legacy/to_legacy/output.css
a {
b: rgb(253.425, 193.575, 204.025);
}

<===>
================================================================================
<===> legacy/to_modern/input.scss
@use 'sass:color';
a {b: color.adjust(pink, $chroma: -0.01, $space: oklch)}

<===> output.css
<===> legacy/to_modern/output.css
a {
b: rgb(249.5073873455, 194.8272088475, 204.1290090118);
}

<===>
================================================================================
<===> modern/to_legacy/input.scss
@use 'sass:color';
a {b: color.adjust(lab(50% 10 -20), $saturation: 5%, $space: hsl)}

<===> modern/to_legacy/output.css
a {
b: lab(48.2797960499% 13.4192461856 -26.2119638245);
}

<===>
================================================================================
<===> modern/to_modern/input.scss
@use 'sass:color';
a {b: color.adjust(lab(50% 10 -20), $chroma: 0.01, $space: oklch)}

<===> modern/to_modern/output.css
a {
b: lab(49.8635566117% 11.8934236813 -23.2342925555);
}

<===>
================================================================================
<===> powerless/legacy/input.scss
@use 'sass:color';
a {b: color.adjust(hsl(0deg 0% 50%), $space: lab)}

<===> powerless/legacy/output.css
a {
b: hsl(0, 0%, 50%);
}

<===>
================================================================================
<===> powerless/modern/input.scss
@use 'sass:color';
a {b: color.adjust(oklch(50% 0 0deg), $space: lab)}

<===> powerless/modern/output.css
a {
b: oklch(50% 0 none);
}

<===>
================================================================================
<===> missing/legacy/same/implicit/input.scss
@use 'sass:color';
a {b: color.adjust(rgb(none none none))}

<===> missing/legacy/same/implicit/output.css
a {
b: rgb(none none none);
}

<===>
================================================================================
<===> missing/legacy/same/explicit/input.scss
@use 'sass:color';
a {b: color.adjust(rgb(none none none), $space: rgb)}

<===> missing/legacy/same/explicit/output.css
a {
b: rgb(none none none);
}

<===>
================================================================================
<===> missing/legacy/analogous/legacy/input.scss
@use 'sass:color';
a {b: color.adjust(hsl(none 50% 50%), $space: hwb)}

<===> missing/legacy/analogous/legacy/output.css
a {
b: hsl(0, 50%, 50%);
}

<===>
================================================================================
<===> missing/legacy/analogous/modern/input.scss
@use 'sass:color';
a {b: color.adjust(rgb(none none none), $space: display-p3)}

<===> missing/legacy/analogous/modern/output.css
a {
b: black;
}

<===>
================================================================================
<===> missing/modern/same/implicit/input.scss
@use 'sass:color';
a {b: color.adjust(color(srgb none none none))}

<===> missing/modern/same/implicit/output.css
a {
b: color(srgb none none none);
}

<===>
================================================================================
<===> missing/modern/same/explicit/input.scss
@use 'sass:color';
a {b: color.adjust(color(srgb none none none), $space: srgb)}

<===> missing/modern/same/explicit/output.css
a {
b: color(srgb none none none);
}

<===>
================================================================================
<===> missing/modern/analogous/input.scss
@use 'sass:color';
a {b: color.adjust(color(srgb none none none), $space: display-p3)}

<===> missing/modern/analogous/output.css
a {
b: color(srgb none none none);
}
13 changes: 13 additions & 0 deletions spec/core_functions/color/adjust_hue.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,16 @@ Error: $degrees: blue is not a number.
| ^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> error/non_legacy/input.scss
a {b: adjust-hue(lch(0% 0 0deg), 10deg)}

<===> error/non_legacy/error
Error: adjust-hue() is only supported for legacy colors. Please use color.adjust() instead with an explicit $space argument.
,
1 | a {b: adjust-hue(lch(0% 0 0deg), 10deg)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet
14 changes: 14 additions & 0 deletions spec/core_functions/color/alpha.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,17 @@ Error: $color: 1=c is not a color.
| ^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> error/non_legacy/input.scss
@use 'sass:color';
a {b: color.alpha(color(srgb 1 1 1))}

<===> error/non_legacy/error
Error: color.alpha() is only supported for legacy colors. Please use color.channel() instead.
,
2 | a {b: color.alpha(color(srgb 1 1 1))}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet
14 changes: 14 additions & 0 deletions spec/core_functions/color/blackness.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,17 @@ Error: $color: 1 is not a color.
| ^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/non_legacy/input.scss
@use 'sass:color';
a {b: color.blackness(color(srgb 1 1 1))}

<===> error/non_legacy/error
Error: color.blackness() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.
,
2 | a {b: color.blackness(color(srgb 1 1 1))}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet
14 changes: 14 additions & 0 deletions spec/core_functions/color/blue.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,17 @@ Error: $color: 1 is not a color.
| ^^^^^^^
'
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> error/non_legacy/input.scss
@use 'sass:color';
a {b: color.blue(color(srgb 1 1 1))}

<===> error/non_legacy/error
Error: color.blue() is only supported for legacy colors. Please use color.channel() instead with an explicit $space argument.
,
2 | a {b: color.blue(color(srgb 1 1 1))}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet
19 changes: 0 additions & 19 deletions spec/core_functions/color/change/no_channels.hrx

This file was deleted.

30 changes: 0 additions & 30 deletions spec/core_functions/color/change/none_case.hrx

This file was deleted.

Loading
Loading