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

Add specs for angle unit deprecations #1608

Merged
merged 4 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
36 changes: 20 additions & 16 deletions spec/core_functions/color/adjust_color/error/bounds.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ Error: argument `$blue` of `adjust-color($color, $red: false, $green: false, $bl
<===>
================================================================================
<===> saturation/too_low/input.scss
a {b: adjust-color(red, $saturation: -100.001)}
a {b: adjust-color(red, $saturation: -100.001%)}

<===> saturation/too_low/error
Error: $saturation: Expected -100.001 to be within -100 and 100.
Error: $saturation: Expected -100.001% to be within -100% and 100%.
,
1 | a {b: adjust-color(red, $saturation: -100.001)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $saturation: -100.001%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand All @@ -146,13 +146,13 @@ Error: argument `$saturation` of `adjust-color($color, $red: false, $green: fals
<===>
================================================================================
<===> saturation/too_high/input.scss
a {b: adjust-color(red, $saturation: 100.001)}
a {b: adjust-color(red, $saturation: 100.001%)}

<===> saturation/too_high/error
Error: $saturation: Expected 100.001 to be within -100 and 100.
Error: $saturation: Expected 100.001% to be within -100% and 100%.
,
1 | a {b: adjust-color(red, $saturation: 100.001)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $saturation: 100.001%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand All @@ -167,13 +167,13 @@ Error: argument `$saturation` of `adjust-color($color, $red: false, $green: fals
<===>
================================================================================
<===> lightness/too_low/input.scss
a {b: adjust-color(red, $lightness: -100.001)}
a {b: adjust-color(red, $lightness: -100.001%)}

<===> lightness/too_low/error
Error: $lightness: Expected -100.001 to be within -100 and 100.
Error: $lightness: Expected -100.001% to be within -100% and 100%.
,
1 | a {b: adjust-color(red, $lightness: -100.001)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $lightness: -100.001%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand All @@ -188,13 +188,13 @@ Error: argument `$lightness` of `adjust-color($color, $red: false, $green: false
<===>
================================================================================
<===> lightness/too_high/input.scss
a {b: adjust-color(red, $lightness: 100.001)}
a {b: adjust-color(red, $lightness: 100.001%)}

<===> lightness/too_high/error
Error: $lightness: Expected 100.001 to be within -100 and 100.
Error: $lightness: Expected 100.001% to be within -100% and 100%.
,
1 | a {b: adjust-color(red, $lightness: 100.001)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $lightness: 100.001%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand Down Expand Up @@ -254,6 +254,8 @@ Error: argument `$alpha` of `adjust-color($color, $red: false, $green: false, $b
:todo:
- sass/libsass#3128

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

Expand Down Expand Up @@ -285,6 +287,8 @@ Error: $blackness: Expected 100.001% to be within -100% and 100%.
:todo:
- sass/libsass#3128

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

Expand Down
24 changes: 12 additions & 12 deletions spec/core_functions/color/adjust_color/error/mixed_formats.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Error: Cannot specify HSL and RGB values for a color at the same time for `adjus
<===>
================================================================================
<===> green_and_saturation/input.scss
a {b: adjust-color(red, $green: 1, $saturation: 1)}
a {b: adjust-color(red, $green: 1, $saturation: 1%)}

<===> green_and_saturation/error
Error: RGB parameters may not be passed along with HSL parameters.
,
1 | a {b: adjust-color(red, $green: 1, $saturation: 1)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $green: 1, $saturation: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand All @@ -41,13 +41,13 @@ Error: Cannot specify HSL and RGB values for a color at the same time for `adjus
<===>
================================================================================
<===> blue_and_lightness/input.scss
a {b: adjust-color(red, $blue: 1, $lightness: 1)}
a {b: adjust-color(red, $blue: 1, $lightness: 1%)}

<===> blue_and_lightness/error
Error: RGB parameters may not be passed along with HSL parameters.
,
1 | a {b: adjust-color(red, $blue: 1, $lightness: 1)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $blue: 1, $lightness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand Down Expand Up @@ -103,13 +103,13 @@ Error: RGB parameters may not be passed along with HWB parameters.
- sass/libsass#3128

<===> saturation_and_blackness/input.scss
a {b: adjust-color(red, $saturation: 1, $blackness: 1%)}
a {b: adjust-color(red, $saturation: 1%, $blackness: 1%)}

<===> saturation_and_blackness/error
Error: HSL parameters may not be passed along with HWB parameters.
,
1 | a {b: adjust-color(red, $saturation: 1, $blackness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $saturation: 1%, $blackness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Expand All @@ -121,12 +121,12 @@ Error: HSL parameters may not be passed along with HWB parameters.
- sass/libsass#3128

<===> lightness_and_whiteness/input.scss
a {b: adjust-color(red, $lightness: 1, $whiteness: 1%)}
a {b: adjust-color(red, $lightness: 1%, $whiteness: 1%)}

<===> lightness_and_whiteness/error
Error: HSL parameters may not be passed along with HWB parameters.
,
1 | a {b: adjust-color(red, $lightness: 1, $whiteness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 | a {b: adjust-color(red, $lightness: 1%, $whiteness: 1%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet
182 changes: 182 additions & 0 deletions spec/core_functions/color/adjust_color/units.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<===> options.yml
---
:warning_todo:
- libsass

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

<===> hue/deg/output.css
a {
b: yellow;
}

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

<===> hue/unitless/output.css
a {
b: yellow;
}

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

<===> hue/unknown/output.css
a {
b: yellow;
}

<===> hue/unknown/warning
DEPRECATION WARNING: $hue: Passing a unit other than deg is deprecated.

To preserve current behavior: $hue / 1in

See https://sass-lang.com/d/color-units

,
1 | a {b: adjust-color(red, $hue: 60in)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> hue/angle/input.scss
a {b: adjust-color(red, $hue: 60rad)}

<===> hue/angle/output.css
a {
b: yellow;
}

<===> hue/angle/warning
DEPRECATION WARNING: $hue: Passing a unit other than deg is deprecated.

You're passing 60rad, which is currently (incorrectly) converted to 60deg.
Soon, it will instead be correctly converted to 3437.7467707849deg.

To preserve current behavior: $hue * 1deg/1rad
To migrate to new behavior: 0deg + $hue

See https://sass-lang.com/d/color-units

,
1 | a {b: adjust-color(red, $hue: 60rad)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

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

<===> saturation/percent/output.css
a {
b: #f20d0d;
}

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

<===> saturation/unitless/output.css
a {
b: #f20d0d;
}

<===> saturation/unitless/warning
DEPRECATION WARNING: $saturation: Passing a number without unit % is deprecated.

To preserve current behavior: $saturation * 1%

,
1 | a {b: adjust-color(red, $saturation: -10)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet


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

<===> saturation/unknown/output.css
a {
b: #f20d0d;
}

<===> saturation/unknown/warning
DEPRECATION WARNING: $saturation: Passing a number without unit % is deprecated.

To preserve current behavior: $saturation / 1in * 1%

,
1 | a {b: adjust-color(red, $saturation: -10in)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet


<===>
================================================================================
<===> lightness/percent/input.scss
a {b: adjust-color(red, $lightness: 10%)}

<===> lightness/percent/output.css
a {
b: #ff3333;
}

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

<===> lightness/unitless/output.css
a {
b: #ff3333;
}

<===> lightness/unitless/warning
DEPRECATION WARNING: $lightness: Passing a number without unit % is deprecated.

To preserve current behavior: $lightness * 1%

,
1 | a {b: adjust-color(red, $lightness: 10)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet


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

<===> lightness/unknown/output.css
a {
b: #ff3333;
}

<===> lightness/unknown/warning
DEPRECATION WARNING: $lightness: Passing a number without unit % is deprecated.

To preserve current behavior: $lightness / 1in * 1%

,
1 | a {b: adjust-color(red, $lightness: 10in)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

Loading