From 249287d6812cef77abee42e6d873157a33a60e5e Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 27 Oct 2022 18:49:56 -0700 Subject: [PATCH 1/5] Update tests for strict function unit deprecations See #1813 See sass/sass#3374 --- .../color/adjust_color/error/bounds.hrx | 14 +++- .../color/adjust_color/units.hrx | 60 +++++++++++++++-- spec/core_functions/color/adjust_hue.hrx | 4 +- .../color/change_color/error/bounds.hrx | 14 +++- .../color/change_color/units.hrx | 60 +++++++++++++++-- .../color/hsl/three_args/units.hrx | 8 +-- .../color/hwb/three_args/units.hrx | 4 +- spec/core_functions/color/invert.hrx | 58 +++++++++++++--- spec/core_functions/color/mix.hrx | 66 ++++++++++++++++++- spec/core_functions/list/nth.hrx | 21 ++++++ spec/core_functions/list/set_nth.hrx | 21 ++++++ spec/libsass/test.hrx | 11 ++++ 12 files changed, 311 insertions(+), 30 deletions(-) diff --git a/spec/core_functions/color/adjust_color/error/bounds.hrx b/spec/core_functions/color/adjust_color/error/bounds.hrx index a14f9eb414..e44dd00980 100644 --- a/spec/core_functions/color/adjust_color/error/bounds.hrx +++ b/spec/core_functions/color/adjust_color/error/bounds.hrx @@ -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)} @@ -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)} @@ -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%)} diff --git a/spec/core_functions/color/adjust_color/units.hrx b/spec/core_functions/color/adjust_color/units.hrx index 1bfd1870d3..2582261eb8 100644 --- a/spec/core_functions/color/adjust_color/units.hrx +++ b/spec/core_functions/color/adjust_color/units.hrx @@ -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 @@ -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 @@ -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)} @@ -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 diff --git a/spec/core_functions/color/adjust_hue.hrx b/spec/core_functions/color/adjust_hue.hrx index 0bd7dc92c0..c19659cfec 100644 --- a/spec/core_functions/color/adjust_hue.hrx +++ b/spec/core_functions/color/adjust_hue.hrx @@ -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 @@ -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 diff --git a/spec/core_functions/color/change_color/error/bounds.hrx b/spec/core_functions/color/change_color/error/bounds.hrx index 86926108f3..66ef95d9f1 100644 --- a/spec/core_functions/color/change_color/error/bounds.hrx +++ b/spec/core_functions/color/change_color/error/bounds.hrx @@ -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)} @@ -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)} @@ -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%)} diff --git a/spec/core_functions/color/change_color/units.hrx b/spec/core_functions/color/change_color/units.hrx index bf7992de27..c7c77a0bd4 100644 --- a/spec/core_functions/color/change_color/units.hrx +++ b/spec/core_functions/color/change_color/units.hrx @@ -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 @@ -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 @@ -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)} @@ -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 diff --git a/spec/core_functions/color/hsl/three_args/units.hrx b/spec/core_functions/color/hsl/three_args/units.hrx index 5fa4ff6dbd..76e59d2a91 100644 --- a/spec/core_functions/color/hsl/three_args/units.hrx +++ b/spec/core_functions/color/hsl/three_args/units.hrx @@ -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 @@ -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 @@ -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%)} @@ -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)} diff --git a/spec/core_functions/color/hwb/three_args/units.hrx b/spec/core_functions/color/hwb/three_args/units.hrx index d1ccf1def6..7ed79c62cc 100644 --- a/spec/core_functions/color/hwb/three_args/units.hrx +++ b/spec/core_functions/color/hwb/three_args/units.hrx @@ -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 @@ -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 diff --git a/spec/core_functions/color/invert.hrx b/spec/core_functions/color/invert.hrx index 164049bc99..acd1e70248 100644 --- a/spec/core_functions/color/invert.hrx +++ b/spec/core_functions/color/invert.hrx @@ -116,6 +116,48 @@ a { b: turquoise; } +<===> +================================================================================ +<===> units/weight/unitless/input.scss +a {b: invert(turquoise, 10)} + +<===> units/weight/unitless/output.css +a { + b: #4dcdc0; +} + +<===> units/weight/unitless/warning +DEPRECATION WARNING: $weight: Passing a number without unit % (10) is deprecated. + +To preserve current behavior: $weight * 1% + + , +1 | a {b: invert(turquoise, 10)} + | ^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> units/weight/unknown/input.scss +a {b: invert(turquoise, 10px)} + +<===> units/weight/unknown/output.css +a { + b: #4dcdc0; +} + +<===> units/weight/unknown/warning +DEPRECATION WARNING: $weight: Passing a number without unit % (10px) is deprecated. + +To preserve current behavior: calc($weight / 1px * 1%) + + , +1 | a {b: invert(turquoise, 10px)} + | ^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + <===> ================================================================================ <===> error/too_few_args/input.scss @@ -222,13 +264,13 @@ Error: argument `$weight` of `invert($color, $weight: 100%)` must be a number <===> ================================================================================ <===> error/bounds/too_low/input.scss -a {b: invert(red, -0.001)} +a {b: invert(red, -0.001%)} <===> error/bounds/too_low/error -Error: $weight: Expected -0.001 to be within 0 and 100. +Error: $weight: Expected -0.001% to be within 0% and 100%. , -1 | a {b: invert(red, -0.001)} - | ^^^^^^^^^^^^^^^^^^^ +1 | a {b: invert(red, -0.001%)} + | ^^^^^^^^^^^^^^^^^^^^ ' input.scss 1:7 root stylesheet @@ -243,13 +285,13 @@ Error: argument `$weight` of `invert($color, $weight: 100%)` must be between -0 <===> ================================================================================ <===> error/bounds/too_high/input.scss -a {b: invert(red, 100.001)} +a {b: invert(red, 100.001%)} <===> error/bounds/too_high/error -Error: $weight: Expected 100.001 to be within 0 and 100. +Error: $weight: Expected 100.001% to be within 0% and 100%. , -1 | a {b: invert(red, 100.001)} - | ^^^^^^^^^^^^^^^^^^^^ +1 | a {b: invert(red, 100.001%)} + | ^^^^^^^^^^^^^^^^^^^^^ ' input.scss 1:7 root stylesheet diff --git a/spec/core_functions/color/mix.hrx b/spec/core_functions/color/mix.hrx index c7904fa3c7..db23914cc7 100644 --- a/spec/core_functions/color/mix.hrx +++ b/spec/core_functions/color/mix.hrx @@ -82,7 +82,7 @@ a { <===> ================================================================================ <===> unitless_weight/firstwards/input.scss -a {b: mix(#91e16f, #0144bf, 92)} +a {b: mix(#91e16f, #0144bf, 92%)} <===> unitless_weight/firstwards/output.css a { @@ -92,7 +92,7 @@ a { <===> ================================================================================ <===> unitless_weight/lastwards/input.scss -a {b: mix(#91e16f, #0144bf, 43)} +a {b: mix(#91e16f, #0144bf, 43%)} <===> unitless_weight/lastwards/output.css a { @@ -232,6 +232,48 @@ a { b: #85d475; } +<===> +================================================================================ +<===> units/weight/unitless/input.scss +a {b: mix(#91e16f, #0144bf, 50)} + +<===> units/weight/unitless/output.css +a { + b: #499397; +} + +<===> units/weight/unitless/warning +DEPRECATION WARNING: $weight: Passing a number without unit % (50) is deprecated. + +To preserve current behavior: $weight * 1% + + , +1 | a {b: mix(#91e16f, #0144bf, 50)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> units/weight/unknown/input.scss +a {b: mix(#91e16f, #0144bf, 50px)} + +<===> units/weight/unknown/output.css +a { + b: #499397; +} + +<===> units/weight/unknown/warning +DEPRECATION WARNING: $weight: Passing a number without unit % (50px) is deprecated. + +To preserve current behavior: calc($weight / 1px * 1%) + + , +1 | a {b: mix(#91e16f, #0144bf, 50px)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + <===> ================================================================================ <===> error/too_many_args/input.scss @@ -349,6 +391,16 @@ Error: argument `$weight` of `mix($color1, $color2, $weight: 50%)` must be a num a {b: mix(red, blue, -0.001)} <===> error/bounds/too_low/error +DEPRECATION WARNING: $weight: Passing a number without unit % (-0.001) is deprecated. + +To preserve current behavior: $weight * 1% + + , +1 | a {b: mix(red, blue, -0.001)} + | ^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + Error: $weight: Expected -0.001 to be within 0 and 100. , 1 | a {b: mix(red, blue, -0.001)} @@ -370,6 +422,16 @@ Error: argument `$weight` of `mix($color1, $color2, $weight: 50%)` must be betwe a {b: mix(red, blue, 100.001)} <===> error/bounds/too_high/error +DEPRECATION WARNING: $weight: Passing a number without unit % (100.001) is deprecated. + +To preserve current behavior: $weight * 1% + + , +1 | a {b: mix(red, blue, 100.001)} + | ^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + Error: $weight: Expected 100.001 to be within 0 and 100. , 1 | a {b: mix(red, blue, 100.001)} diff --git a/spec/core_functions/list/nth.hrx b/spec/core_functions/list/nth.hrx index a06fb0785a..2026bc15f8 100644 --- a/spec/core_functions/list/nth.hrx +++ b/spec/core_functions/list/nth.hrx @@ -116,6 +116,27 @@ a { b: d; } +<===> +================================================================================ +<===> units/input.scss +a {b: nth(c d, 1px)} + +<===> units/output.css +a { + b: c; +} + +<===> units/warning +WARNING: $n: Passing a number with unit px is deprecated. + +To preserve current behavior: calc($n / 1px) + + , +1 | a {b: nth(c d, 1px)} + | ^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + <===> ================================================================================ <===> error/type/input.scss diff --git a/spec/core_functions/list/set_nth.hrx b/spec/core_functions/list/set_nth.hrx index 10be544804..f4ac565e63 100644 --- a/spec/core_functions/list/set_nth.hrx +++ b/spec/core_functions/list/set_nth.hrx @@ -131,6 +131,27 @@ a { b: [c, e]; } +<===> +================================================================================ +<===> units/input.scss +a {b: set-nth(c d, 1px, e)} + +<===> units/output.css +a { + b: e d; +} + +<===> units/warning +WARNING: $n: Passing a number with unit px is deprecated. + +To preserve current behavior: calc($n / 1px) + + , +1 | a {b: set-nth(c d, 1px, e)} + | ^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + <===> ================================================================================ <===> error/type/input.scss diff --git a/spec/libsass/test.hrx b/spec/libsass/test.hrx index c2833e3df6..d1102867c3 100644 --- a/spec/libsass/test.hrx +++ b/spec/libsass/test.hrx @@ -213,3 +213,14 @@ gudge { h1:lang(en) { foo: bar; } + +<===> warning +WARNING: $n: Passing a number with unit px is deprecated. + +To preserve current behavior: calc($n / 1px) + + , +46 | krug: nth(1 2 3, 2px); + | ^^^^^^^^^^^^^^^ + ' + input.scss 46:9 root stylesheet From 515ef9ee1c93bf30b65820ea089b7774ee5dc461 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 27 Oct 2022 19:03:21 -0700 Subject: [PATCH 2/5] Ignore LibSass failures --- spec/core_functions/color/invert.hrx | 8 ++++++++ spec/core_functions/color/mix.hrx | 8 ++++++++ spec/core_functions/list/nth.hrx | 4 ++++ spec/core_functions/list/set_nth.hrx | 4 ++++ spec/libsass/test.hrx | 4 ++++ 5 files changed, 28 insertions(+) diff --git a/spec/core_functions/color/invert.hrx b/spec/core_functions/color/invert.hrx index acd1e70248..1288fbadb0 100644 --- a/spec/core_functions/color/invert.hrx +++ b/spec/core_functions/color/invert.hrx @@ -118,6 +118,10 @@ a { <===> ================================================================================ +<===> units/weight/unitless/options.yml +:ignore_for: + - libsass + <===> units/weight/unitless/input.scss a {b: invert(turquoise, 10)} @@ -139,6 +143,10 @@ To preserve current behavior: $weight * 1% <===> ================================================================================ +<===> units/weight/unknown/options.yml +:ignore_for: + - libsass + <===> units/weight/unknown/input.scss a {b: invert(turquoise, 10px)} diff --git a/spec/core_functions/color/mix.hrx b/spec/core_functions/color/mix.hrx index db23914cc7..1d7f805f6f 100644 --- a/spec/core_functions/color/mix.hrx +++ b/spec/core_functions/color/mix.hrx @@ -234,6 +234,10 @@ a { <===> ================================================================================ +<===> units/weight/unitless/options.yml +:ignore_for: + - libsass + <===> units/weight/unitless/input.scss a {b: mix(#91e16f, #0144bf, 50)} @@ -255,6 +259,10 @@ To preserve current behavior: $weight * 1% <===> ================================================================================ +<===> units/weight/unknown/options.yml +:ignore_for: + - libsass + <===> units/weight/unknown/input.scss a {b: mix(#91e16f, #0144bf, 50px)} diff --git a/spec/core_functions/list/nth.hrx b/spec/core_functions/list/nth.hrx index 2026bc15f8..b14e571369 100644 --- a/spec/core_functions/list/nth.hrx +++ b/spec/core_functions/list/nth.hrx @@ -118,6 +118,10 @@ a { <===> ================================================================================ +<===> units/options.yml +:ignore_for: + - libsass + <===> units/input.scss a {b: nth(c d, 1px)} diff --git a/spec/core_functions/list/set_nth.hrx b/spec/core_functions/list/set_nth.hrx index f4ac565e63..206d95ffe0 100644 --- a/spec/core_functions/list/set_nth.hrx +++ b/spec/core_functions/list/set_nth.hrx @@ -133,6 +133,10 @@ a { <===> ================================================================================ +<===> units/options.yml +:ignore_for: + - libsass + <===> units/input.scss a {b: set-nth(c d, 1px, e)} diff --git a/spec/libsass/test.hrx b/spec/libsass/test.hrx index d1102867c3..667fb99159 100644 --- a/spec/libsass/test.hrx +++ b/spec/libsass/test.hrx @@ -1,3 +1,7 @@ +<===> options.yml +:ignore_for: + - libsass + <===> input.scss $x: 3; From 4ef772ceec5eebac9ce697d95598a3f715f0d96c Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 27 Oct 2022 19:22:42 -0700 Subject: [PATCH 3/5] Mark warnings as deprecations and add more info links --- .../color/adjust_color/error/bounds.hrx | 8 +++++++- spec/core_functions/color/adjust_color/units.hrx | 16 ++++++++++++++-- .../color/change_color/error/bounds.hrx | 8 +++++++- spec/core_functions/color/change_color/units.hrx | 16 ++++++++++++++-- .../color/hsl/one_arg/no_alpha.hrx | 4 ++++ .../color/hsl/three_args/units.hrx | 8 ++++++++ spec/core_functions/color/invert.hrx | 4 ++++ spec/core_functions/color/mix.hrx | 8 ++++++++ spec/core_functions/list/nth.hrx | 4 +++- spec/core_functions/list/set_nth.hrx | 4 +++- spec/core_functions/math/random.hrx | 5 +++-- spec/libsass/test.hrx | 4 +++- 12 files changed, 78 insertions(+), 11 deletions(-) diff --git a/spec/core_functions/color/adjust_color/error/bounds.hrx b/spec/core_functions/color/adjust_color/error/bounds.hrx index e44dd00980..03e71f05b1 100644 --- a/spec/core_functions/color/adjust_color/error/bounds.hrx +++ b/spec/core_functions/color/adjust_color/error/bounds.hrx @@ -245,6 +245,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (200px) is dep To preserve current behavior: calc($saturation / 1px * 1%) +More info: https://sass-lang.com/d/function-units + , 3 | a {b: adjust-color(red, $saturation: 200px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -320,6 +322,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (200px) is depr To preserve current behavior: calc($lightness / 1px * 1%) +More info: https://sass-lang.com/d/function-units + , 3 | a {b: adjust-color(red, $lightness: 200px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -391,10 +395,12 @@ 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. +DEPRECATION WARNING: $alpha: Passing a number with unit % is deprecated. To preserve current behavior: calc($alpha / 1%) +More info: https://sass-lang.com/d/function-units + , 3 | a {b: adjust-color(red, $alpha: 50%)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/adjust_color/units.hrx b/spec/core_functions/color/adjust_color/units.hrx index 2582261eb8..f4f70a0c08 100644 --- a/spec/core_functions/color/adjust_color/units.hrx +++ b/spec/core_functions/color/adjust_color/units.hrx @@ -98,6 +98,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (-10) is depre To preserve current behavior: $saturation * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $saturation: -10)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,6 +121,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (-10in) is dep To preserve current behavior: calc($saturation / 1in * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $saturation: -10in)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -150,6 +154,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (10) is depreca To preserve current behavior: $lightness * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $lightness: 10)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,6 +177,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (10in) is depre To preserve current behavior: calc($lightness / 1in * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $lightness: 10in)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -198,10 +206,12 @@ a { } <===> alpha/percent/warning -WARNING: $alpha: Passing a number with unit % is deprecated. +DEPRECATION WARNING: $alpha: Passing a number with unit % is deprecated. To preserve current behavior: calc($alpha / 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $alpha: -0.3%)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -219,10 +229,12 @@ a { } <===> alpha/unknown/warning -WARNING: $alpha: Passing a number with unit px is deprecated. +DEPRECATION WARNING: $alpha: Passing a number with unit px is deprecated. To preserve current behavior: calc($alpha / 1px) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $alpha: -0.3px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/change_color/error/bounds.hrx b/spec/core_functions/color/change_color/error/bounds.hrx index 66ef95d9f1..ae90fcc5d0 100644 --- a/spec/core_functions/color/change_color/error/bounds.hrx +++ b/spec/core_functions/color/change_color/error/bounds.hrx @@ -245,6 +245,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (200px) is dep To preserve current behavior: calc($saturation / 1px * 1%) +More info: https://sass-lang.com/d/function-units + , 3 | a {b: change-color(red, $saturation: 200px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -320,6 +322,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (200px) is depr To preserve current behavior: calc($lightness / 1px * 1%) +More info: https://sass-lang.com/d/function-units + , 3 | a {b: change-color(red, $lightness: 200px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -391,10 +395,12 @@ 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. +DEPRECATION WARNING: $alpha: Passing a number with unit % is deprecated. To preserve current behavior: calc($alpha / 1%) +More info: https://sass-lang.com/d/function-units + , 3 | a {b: change-color(red, $alpha: 50%)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/change_color/units.hrx b/spec/core_functions/color/change_color/units.hrx index c7c77a0bd4..87fb30e1ea 100644 --- a/spec/core_functions/color/change_color/units.hrx +++ b/spec/core_functions/color/change_color/units.hrx @@ -98,6 +98,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (50) is deprec To preserve current behavior: $saturation * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: change-color(red, $saturation: 50)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,6 +121,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (50in) is depr To preserve current behavior: calc($saturation / 1in * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: change-color(red, $saturation: 50in)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -150,6 +154,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (30) is depreca To preserve current behavior: $lightness * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: change-color(red, $lightness: 30)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,6 +177,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (30in) is depre To preserve current behavior: calc($lightness / 1in * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: change-color(red, $lightness: 30in)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -198,10 +206,12 @@ a { } <===> alpha/percent/warning -WARNING: $alpha: Passing a number with unit % is deprecated. +DEPRECATION WARNING: $alpha: Passing a number with unit % is deprecated. To preserve current behavior: calc($alpha / 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $alpha: 0.5%)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -219,10 +229,12 @@ a { } <===> alpha/unknown/warning -WARNING: $alpha: Passing a number with unit px is deprecated. +DEPRECATION WARNING: $alpha: Passing a number with unit px is deprecated. To preserve current behavior: calc($alpha / 1px) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: adjust-color(red, $alpha: 0.5px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/hsl/one_arg/no_alpha.hrx b/spec/core_functions/color/hsl/one_arg/no_alpha.hrx index a9fa07f3a4..73c938a984 100644 --- a/spec/core_functions/color/hsl/one_arg/no_alpha.hrx +++ b/spec/core_functions/color/hsl/one_arg/no_alpha.hrx @@ -91,6 +91,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (50) is deprec To preserve current behavior: $saturation * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: hsl(0 50 50%)} | ^^^^^^^^^^^^^ @@ -112,6 +114,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (50) is depreca To preserve current behavior: $lightness * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: hsl(0 100% 50)} | ^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/hsl/three_args/units.hrx b/spec/core_functions/color/hsl/three_args/units.hrx index 76e59d2a91..eb576862ee 100644 --- a/spec/core_functions/color/hsl/three_args/units.hrx +++ b/spec/core_functions/color/hsl/three_args/units.hrx @@ -117,6 +117,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (50) is deprec To preserve current behavior: $saturation * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: hsl(0, 50, 50%)} | ^^^^^^^^^^^^^^^ @@ -145,6 +147,8 @@ DEPRECATION WARNING: $saturation: Passing a number without unit % (50in) is depr To preserve current behavior: calc($saturation / 1in * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: hsl(0, 50in, 50%)} | ^^^^^^^^^^^^^^^^^ @@ -173,6 +177,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (50) is depreca To preserve current behavior: $lightness * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: hsl(0, 100%, 50)} | ^^^^^^^^^^^^^^^^ @@ -201,6 +207,8 @@ DEPRECATION WARNING: $lightness: Passing a number without unit % (50in) is depre To preserve current behavior: calc($lightness / 1in * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: hsl(0, 100%, 50in)} | ^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/invert.hrx b/spec/core_functions/color/invert.hrx index 1288fbadb0..fb0d8976a6 100644 --- a/spec/core_functions/color/invert.hrx +++ b/spec/core_functions/color/invert.hrx @@ -135,6 +135,8 @@ DEPRECATION WARNING: $weight: Passing a number without unit % (10) is deprecated To preserve current behavior: $weight * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: invert(turquoise, 10)} | ^^^^^^^^^^^^^^^^^^^^^ @@ -160,6 +162,8 @@ DEPRECATION WARNING: $weight: Passing a number without unit % (10px) is deprecat To preserve current behavior: calc($weight / 1px * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: invert(turquoise, 10px)} | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/color/mix.hrx b/spec/core_functions/color/mix.hrx index 1d7f805f6f..223b993994 100644 --- a/spec/core_functions/color/mix.hrx +++ b/spec/core_functions/color/mix.hrx @@ -251,6 +251,8 @@ DEPRECATION WARNING: $weight: Passing a number without unit % (50) is deprecated To preserve current behavior: $weight * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: mix(#91e16f, #0144bf, 50)} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -276,6 +278,8 @@ DEPRECATION WARNING: $weight: Passing a number without unit % (50px) is deprecat To preserve current behavior: calc($weight / 1px * 1%) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: mix(#91e16f, #0144bf, 50px)} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -403,6 +407,8 @@ DEPRECATION WARNING: $weight: Passing a number without unit % (-0.001) is deprec To preserve current behavior: $weight * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: mix(red, blue, -0.001)} | ^^^^^^^^^^^^^^^^^^^^^^ @@ -434,6 +440,8 @@ DEPRECATION WARNING: $weight: Passing a number without unit % (100.001) is depre To preserve current behavior: $weight * 1% +More info: https://sass-lang.com/d/function-units + , 1 | a {b: mix(red, blue, 100.001)} | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/list/nth.hrx b/spec/core_functions/list/nth.hrx index b14e571369..65ad358c36 100644 --- a/spec/core_functions/list/nth.hrx +++ b/spec/core_functions/list/nth.hrx @@ -131,10 +131,12 @@ a { } <===> units/warning -WARNING: $n: Passing a number with unit px is deprecated. +DEPRECATION WARNING: $n: Passing a number with unit px is deprecated. To preserve current behavior: calc($n / 1px) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: nth(c d, 1px)} | ^^^^^^^^^^^^^ diff --git a/spec/core_functions/list/set_nth.hrx b/spec/core_functions/list/set_nth.hrx index 206d95ffe0..1094bba9c8 100644 --- a/spec/core_functions/list/set_nth.hrx +++ b/spec/core_functions/list/set_nth.hrx @@ -146,10 +146,12 @@ a { } <===> units/warning -WARNING: $n: Passing a number with unit px is deprecated. +DEPRECATION WARNING: $n: Passing a number with unit px is deprecated. To preserve current behavior: calc($n / 1px) +More info: https://sass-lang.com/d/function-units + , 1 | a {b: set-nth(c d, 1px, e)} | ^^^^^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/math/random.hrx b/spec/core_functions/math/random.hrx index d2ca87cd30..e125e8f621 100644 --- a/spec/core_functions/math/random.hrx +++ b/spec/core_functions/math/random.hrx @@ -89,13 +89,14 @@ a { } <===> ignores_units/warning -WARNING: math.random() will no longer ignore $limit units (1px) in a future release. +DEPRECATION WARNING: math.random() will no longer ignore $limit units (1px) in a future release. Recommendation: math.random(math.div($limit, 1px)) * 1px To preserve current behavior: math.random(math.div($limit, 1px)) -More info: https://sass-lang.com/d/random-with-units +More info: https://sass-lang.com/d/function-units + , 1 | a {b: random(1px)} | ^^^^^^^^^^^ diff --git a/spec/libsass/test.hrx b/spec/libsass/test.hrx index 667fb99159..3b53f01844 100644 --- a/spec/libsass/test.hrx +++ b/spec/libsass/test.hrx @@ -219,10 +219,12 @@ h1:lang(en) { } <===> warning -WARNING: $n: Passing a number with unit px is deprecated. +DEPRECATION WARNING: $n: Passing a number with unit px is deprecated. To preserve current behavior: calc($n / 1px) +More info: https://sass-lang.com/d/function-units + , 46 | krug: nth(1 2 3, 2px); | ^^^^^^^^^^^^^^^ From 317d698680e5f8c545c1068cac175bbd324b83cf Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 27 Oct 2022 19:43:46 -0700 Subject: [PATCH 4/5] Code review --- spec/core_functions/color/mix.hrx | 48 ++----------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/spec/core_functions/color/mix.hrx b/spec/core_functions/color/mix.hrx index 223b993994..76e6fd3276 100644 --- a/spec/core_functions/color/mix.hrx +++ b/spec/core_functions/color/mix.hrx @@ -79,26 +79,6 @@ a { b: #3f889d; } -<===> -================================================================================ -<===> unitless_weight/firstwards/input.scss -a {b: mix(#91e16f, #0144bf, 92%)} - -<===> unitless_weight/firstwards/output.css -a { - b: #85d475; -} - -<===> -================================================================================ -<===> unitless_weight/lastwards/input.scss -a {b: mix(#91e16f, #0144bf, 43%)} - -<===> unitless_weight/lastwards/output.css -a { - b: #3f889d; -} - <===> ================================================================================ <===> alpha/even/input.scss @@ -400,21 +380,9 @@ Error: argument `$weight` of `mix($color1, $color2, $weight: 50%)` must be a num <===> ================================================================================ <===> error/bounds/too_low/input.scss -a {b: mix(red, blue, -0.001)} +a {b: mix(red, blue, -0.001%)} <===> error/bounds/too_low/error -DEPRECATION WARNING: $weight: Passing a number without unit % (-0.001) is deprecated. - -To preserve current behavior: $weight * 1% - -More info: https://sass-lang.com/d/function-units - - , -1 | a {b: mix(red, blue, -0.001)} - | ^^^^^^^^^^^^^^^^^^^^^^ - ' - input.scss 1:7 root stylesheet - Error: $weight: Expected -0.001 to be within 0 and 100. , 1 | a {b: mix(red, blue, -0.001)} @@ -433,21 +401,9 @@ Error: argument `$weight` of `mix($color1, $color2, $weight: 50%)` must be betwe <===> ================================================================================ <===> error/bounds/too_high/input.scss -a {b: mix(red, blue, 100.001)} +a {b: mix(red, blue, 100.001%)} <===> error/bounds/too_high/error -DEPRECATION WARNING: $weight: Passing a number without unit % (100.001) is deprecated. - -To preserve current behavior: $weight * 1% - -More info: https://sass-lang.com/d/function-units - - , -1 | a {b: mix(red, blue, 100.001)} - | ^^^^^^^^^^^^^^^^^^^^^^^ - ' - input.scss 1:7 root stylesheet - Error: $weight: Expected 100.001 to be within 0 and 100. , 1 | a {b: mix(red, blue, 100.001)} From 256f50d8639cd64f39ef37fe63fa7f34ab7756fc Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 27 Oct 2022 20:01:30 -0700 Subject: [PATCH 5/5] Update expectations --- spec/core_functions/color/mix.hrx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/core_functions/color/mix.hrx b/spec/core_functions/color/mix.hrx index 76e6fd3276..2f6d21c09d 100644 --- a/spec/core_functions/color/mix.hrx +++ b/spec/core_functions/color/mix.hrx @@ -383,10 +383,10 @@ Error: argument `$weight` of `mix($color1, $color2, $weight: 50%)` must be a num a {b: mix(red, blue, -0.001%)} <===> error/bounds/too_low/error -Error: $weight: Expected -0.001 to be within 0 and 100. +Error: $weight: Expected -0.001% to be within 0% and 100%. , -1 | a {b: mix(red, blue, -0.001)} - | ^^^^^^^^^^^^^^^^^^^^^^ +1 | a {b: mix(red, blue, -0.001%)} + | ^^^^^^^^^^^^^^^^^^^^^^^ ' input.scss 1:7 root stylesheet @@ -404,10 +404,10 @@ Error: argument `$weight` of `mix($color1, $color2, $weight: 50%)` must be betwe a {b: mix(red, blue, 100.001%)} <===> error/bounds/too_high/error -Error: $weight: Expected 100.001 to be within 0 and 100. +Error: $weight: Expected 100.001% to be within 0% and 100%. , -1 | a {b: mix(red, blue, 100.001)} - | ^^^^^^^^^^^^^^^^^^^^^^^ +1 | a {b: mix(red, blue, 100.001%)} + | ^^^^^^^^^^^^^^^^^^^^^^^^ ' input.scss 1:7 root stylesheet