Skip to content

Commit

Permalink
Update tests for strict function unit deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Oct 28, 2022
1 parent df67c75 commit 249287d
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 30 deletions.
14 changes: 12 additions & 2 deletions spec/core_functions/color/adjust_color/error/bounds.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ a {b: adjust-color(red, $saturation: 200px)}
<===> saturation/unit/error
DEPRECATION WARNING: $saturation: Passing a number without unit % (200px) is deprecated.

To preserve current behavior: $saturation / 1px * 1%
To preserve current behavior: calc($saturation / 1px * 1%)

,
3 | a {b: adjust-color(red, $saturation: 200px)}
Expand Down Expand Up @@ -318,7 +318,7 @@ a {b: adjust-color(red, $lightness: 200px)}
<===> lightness/unit/error
DEPRECATION WARNING: $lightness: Passing a number without unit % (200px) is deprecated.

To preserve current behavior: $lightness / 1px * 1%
To preserve current behavior: calc($lightness / 1px * 1%)

,
3 | a {b: adjust-color(red, $lightness: 200px)}
Expand Down Expand Up @@ -391,6 +391,16 @@ Error: argument `$alpha` of `adjust-color($color, $red: false, $green: false, $b
a {b: adjust-color(red, $alpha: 50%)}

<===> alpha/unit/error
WARNING: $alpha: Passing a number with unit % is deprecated.

To preserve current behavior: calc($alpha / 1%)

,
3 | a {b: adjust-color(red, $alpha: 50%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 3:7 root stylesheet

Error: $alpha: Expected 50% to be within -1 and 1.
,
3 | a {b: adjust-color(red, $alpha: 50%)}
Expand Down
60 changes: 56 additions & 4 deletions spec/core_functions/color/adjust_color/units.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ a {
<===> hue/unknown/warning
DEPRECATION WARNING: $hue: Passing a unit other than deg (60in) is deprecated.

To preserve current behavior: $hue / 1in
To preserve current behavior: calc($hue / 1in)

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

Expand All @@ -62,7 +62,7 @@ DEPRECATION WARNING: $hue: Passing a unit other than deg (60rad) 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 preserve current behavior: calc($hue * 1deg/1rad)
To migrate to new behavior: 0deg + $hue

See https://sass-lang.com/d/color-units
Expand Down Expand Up @@ -117,7 +117,7 @@ a {
<===> saturation/unknown/warning
DEPRECATION WARNING: $saturation: Passing a number without unit % (-10in) is deprecated.

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

,
1 | a {b: adjust-color(red, $saturation: -10in)}
Expand Down Expand Up @@ -169,10 +169,62 @@ a {
<===> lightness/unknown/warning
DEPRECATION WARNING: $lightness: Passing a number without unit % (10in) is deprecated.

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

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

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

<===> alpha/unitless/output.css
a {
b: rgba(255, 0, 0, 0.7);
}

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

<===> alpha/percent/output.css
a {
b: rgba(255, 0, 0, 0.7);
}

<===> alpha/percent/warning
WARNING: $alpha: Passing a number with unit % is deprecated.

To preserve current behavior: calc($alpha / 1%)

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

<===>
================================================================================
<===> alpha/unknown/input.scss
a {b: adjust-color(red, $alpha: -0.3px)}

<===> alpha/unknown/output.css
a {
b: rgba(255, 0, 0, 0.7);
}

<===> alpha/unknown/warning
WARNING: $alpha: Passing a number with unit px is deprecated.

To preserve current behavior: calc($alpha / 1px)

,
1 | a {b: adjust-color(red, $alpha: -0.3px)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet
4 changes: 2 additions & 2 deletions spec/core_functions/color/adjust_hue.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ a {
<===> units/unknown/warning
DEPRECATION WARNING: $degrees: Passing a unit other than deg (60in) is deprecated.

To preserve current behavior: $degrees / 1in
To preserve current behavior: calc($degrees / 1in)

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

Expand All @@ -142,7 +142,7 @@ DEPRECATION WARNING: $degrees: Passing a unit other than deg (60rad) is deprecat
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: $degrees * 1deg/1rad
To preserve current behavior: calc($degrees * 1deg/1rad)
To migrate to new behavior: 0deg + $degrees

See https://sass-lang.com/d/color-units
Expand Down
14 changes: 12 additions & 2 deletions spec/core_functions/color/change_color/error/bounds.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ a {b: change-color(red, $saturation: 200px)}
<===> saturation/unit/error
DEPRECATION WARNING: $saturation: Passing a number without unit % (200px) is deprecated.

To preserve current behavior: $saturation / 1px * 1%
To preserve current behavior: calc($saturation / 1px * 1%)

,
3 | a {b: change-color(red, $saturation: 200px)}
Expand Down Expand Up @@ -318,7 +318,7 @@ a {b: change-color(red, $lightness: 200px)}
<===> lightness/unit/error
DEPRECATION WARNING: $lightness: Passing a number without unit % (200px) is deprecated.

To preserve current behavior: $lightness / 1px * 1%
To preserve current behavior: calc($lightness / 1px * 1%)

,
3 | a {b: change-color(red, $lightness: 200px)}
Expand Down Expand Up @@ -391,6 +391,16 @@ Error: argument `$alpha` of `change-color($color, $red: false, $green: false, $b
a {b: change-color(red, $alpha: 50%)}

<===> alpha/unit/error
WARNING: $alpha: Passing a number with unit % is deprecated.

To preserve current behavior: calc($alpha / 1%)

,
3 | a {b: change-color(red, $alpha: 50%)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 3:7 root stylesheet

Error: $alpha: Expected 50% to be within 0 and 1.
,
3 | a {b: change-color(red, $alpha: 50%)}
Expand Down
60 changes: 56 additions & 4 deletions spec/core_functions/color/change_color/units.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ a {
<===> hue/unknown/warning
DEPRECATION WARNING: $hue: Passing a unit other than deg (60in) is deprecated.

To preserve current behavior: $hue / 1in
To preserve current behavior: calc($hue / 1in)

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

Expand All @@ -62,7 +62,7 @@ DEPRECATION WARNING: $hue: Passing a unit other than deg (60rad) 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 preserve current behavior: calc($hue * 1deg/1rad)
To migrate to new behavior: 0deg + $hue

See https://sass-lang.com/d/color-units
Expand Down Expand Up @@ -117,7 +117,7 @@ a {
<===> saturation/unknown/warning
DEPRECATION WARNING: $saturation: Passing a number without unit % (50in) is deprecated.

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

,
1 | a {b: change-color(red, $saturation: 50in)}
Expand Down Expand Up @@ -169,10 +169,62 @@ a {
<===> lightness/unknown/warning
DEPRECATION WARNING: $lightness: Passing a number without unit % (30in) is deprecated.

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

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

<===>
================================================================================
<===> alpha/unitless/input.scss
a {b: change-color(red, $alpha: 0.5)}

<===> alpha/unitless/output.css
a {
b: rgba(255, 0, 0, 0.5);
}

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

<===> alpha/percent/output.css
a {
b: red;
}

<===> alpha/percent/warning
WARNING: $alpha: Passing a number with unit % is deprecated.

To preserve current behavior: calc($alpha / 1%)

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

<===>
================================================================================
<===> alpha/unknown/input.scss
a {b: adjust-color(red, $alpha: 0.5px)}

<===> alpha/unknown/output.css
a {
b: red;
}

<===> alpha/unknown/warning
WARNING: $alpha: Passing a number with unit px is deprecated.

To preserve current behavior: calc($alpha / 1px)

,
1 | a {b: adjust-color(red, $alpha: 0.5px)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet
8 changes: 4 additions & 4 deletions spec/core_functions/color/hsl/three_args/units.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ a {
<===> hue/unknown/warning
DEPRECATION WARNING: $hue: Passing a unit other than deg (60in) is deprecated.

To preserve current behavior: $hue / 1in
To preserve current behavior: calc($hue / 1in)

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

Expand Down Expand Up @@ -84,7 +84,7 @@ DEPRECATION WARNING: $hue: Passing a unit other than deg (60rad) 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 preserve current behavior: calc($hue * 1deg/1rad)
To migrate to new behavior: 0deg + $hue

See https://sass-lang.com/d/color-units
Expand Down Expand Up @@ -143,7 +143,7 @@ a {
<===> saturation/unknown/warning
DEPRECATION WARNING: $saturation: Passing a number without unit % (50in) is deprecated.

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

,
1 | a {b: hsl(0, 50in, 50%)}
Expand Down Expand Up @@ -199,7 +199,7 @@ a {
<===> lightness/unknown/warning
DEPRECATION WARNING: $lightness: Passing a number without unit % (50in) is deprecated.

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

,
1 | a {b: hsl(0, 100%, 50in)}
Expand Down
4 changes: 2 additions & 2 deletions spec/core_functions/color/hwb/three_args/units.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DEPRECATION WARNING: $hue: Passing a unit other than deg (1rad) is deprecated.
You're passing 1rad, which is currently (incorrectly) converted to 1deg.
Soon, it will instead be correctly converted to 57.2957795131deg.

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

See https://sass-lang.com/d/color-units
Expand All @@ -49,7 +49,7 @@ a {
<===> hue/non_angle/warning
DEPRECATION WARNING: $hue: Passing a unit other than deg (1in) is deprecated.

To preserve current behavior: $hue / 1in
To preserve current behavior: calc($hue / 1in)

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

Expand Down
Loading

0 comments on commit 249287d

Please sign in to comment.