Skip to content

Commit

Permalink
Final review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelalozano16 committed Jul 5, 2023
1 parent 6d15ea1 commit 33bf4be
Show file tree
Hide file tree
Showing 22 changed files with 1,202 additions and 379 deletions.
30 changes: 18 additions & 12 deletions spec/core_functions/math/abs.hrx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<===> options.yml
---
:ignore_for:
- libsass

<===>
================================================================================
<===> zero/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(0)}

<===> zero/output.css
Expand All @@ -10,7 +17,7 @@ a {
<===>
================================================================================
<===> positive/integer/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(1)}

<===> positive/integer/output.css
Expand All @@ -21,7 +28,7 @@ a {
<===>
================================================================================
<===> positive/decimal/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(5.6)}

<===> positive/decimal/output.css
Expand All @@ -32,7 +39,7 @@ a {
<===>
================================================================================
<===> negative/integer/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(-17)}

<===> negative/integer/output.css
Expand All @@ -43,7 +50,7 @@ a {
<===>
================================================================================
<===> negative/decimal/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(-123.456)}

<===> negative/decimal/output.css
Expand All @@ -58,7 +65,7 @@ a {
- sass/libsass#2887

<===> preserves_units/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(-7px / 4em) * 1em}

<===> preserves_units/output.css
Expand All @@ -82,9 +89,8 @@ More info and automated migrator: https://sass-lang.com/d/slash-div
<===>
================================================================================
<===> named/input.scss
@use "sass:math" as math;
$number: -3;
a {b: math.abs($number)}
@use "sass:math";
a { b: math.abs($number: 3)}

<===> named/output.css
a {
Expand All @@ -94,7 +100,7 @@ a {
<===>
================================================================================
<===> error/type/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(c)}

<===> error/type/error
Expand All @@ -116,7 +122,7 @@ Error: argument `$number` of `math.abs($number)` must be a number
<===>
================================================================================
<===> error/too_few_args/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs()}

<===> error/too_few_args/error
Expand All @@ -141,7 +147,7 @@ Error: Function abs is missing argument $number.
<===>
================================================================================
<===> error/too_many_args/input.scss
@use "sass:math" as math;
@use "sass:math";
a {b: math.abs(1, 2)}

<===> error/too_many_args/error
Expand Down
4 changes: 2 additions & 2 deletions spec/core_functions/math/pow/arguments.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Error: $exponent: "0" is not a number.
a {b: math.pow(1px, 0)}

<===> error/base_has_units/error
Error: Expected 1px to have no units.
Error: $base: Expected 1px to have no units.
,
2 | a {b: math.pow(1px, 0)}
| ^^^^^^^^^^^^^^^^
Expand All @@ -56,7 +56,7 @@ Error: Expected 1px to have no units.
a {b: math.pow(0, 1px)}

<===> error/exponent_has_units/error
Error: Expected 1px to have no units.
Error: $exponent: Expected 1px to have no units.
,
2 | a {b: math.pow(0, 1px)}
| ^^^^^^^^^^^^^^^^
Expand Down
7 changes: 7 additions & 0 deletions spec/core_functions/math/round.hrx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<===> options.yml
---
:ignore_for:
- libsass

<===>
================================================================================
<===> integer/input.scss
@use "sass:math";
a {b: math.round(1)}
Expand Down
2 changes: 1 addition & 1 deletion spec/core_functions/math/sqrt.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Error: $number: "0" is not a number.
a {b: math.sqrt(1px)}

<===> error/units/error
Error: Expected 1px to have no units.
Error: $number: Expected 1px to have no units.
,
2 | a {b: math.sqrt(1px)}
| ^^^^^^^^^^^^^^
Expand Down
140 changes: 113 additions & 27 deletions spec/values/calculation/abs.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,117 @@ a {
<===>
================================================================================
<===> positive/decimal/input.scss
a {b: abs(5.6)}
a {b: abs(-5.6px)}

<===> positive/decimal/output.css
a {
b: 5.6;
b: 5.6px;
}

<===>
================================================================================
<===> negative/integer/input.scss
a {b: abs(-17)}
<===> operation/integer/input.scss
a {b: abs(17 * 5%)}

<===> negative/integer/output.css
<===> operation/integer/output.css
a {
b: 17;
b: 85%;
}

<===> operation/integer/warning
DEPRECATION WARNING: Passing percentage units to the global abs() function is deprecated.
In the future, this will emit a CSS abs() function to be resolved by the browser.

To preserve current behavior:
math.abs(85%)
To emit a CSS abs() now:
abs(#{85%})
More info: https://sass-lang.com/documentation/values/calculations#abs
,
1 | a {b: abs(17 * 5%)}
| ^^^^^^^^^^^^^^^^^^^
'
input.scss 1:1 root stylesheet

<===>
================================================================================
<===> negative/decimal/input.scss
a {b: abs(-123.456)}
<===> operation/variable/input.scss
a {
--test: 5;
b: abs(1px + 2px - var(--test))
}

<===> negative/decimal/output.css
<===> operation/variable/output.css
a {
b: 123.456;
--test: 5;
b: abs(3px - var(--test));
}

<===>
================================================================================
<===> named/input.scss
$number: -3;
a {b: abs($number)}
<===> operation/incompatible_units/input.scss
a {b: abs(17px * 5%)}

<===> operation/incompatible_units/error
Error: 85px*% isn't a valid CSS value.
,
1 | a {b: abs(17px * 5%)}
| ^^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet

<===> named/output.css
<===>
================================================================================
<===> preserved/operation/incompatible_units/input.scss
a {b: abs(17px + 5%)}

<===> preserved/operation/incompatible_units/output.css
a {
b: abs(17px + 5%);
}

<===>
================================================================================
<===> preserved/variable/input.scss
a {
--test: 5;
b: abs(var(--test))
}

<===> preserved/variable/output.css
a {
--test: 5;
b: abs(var(--test));
}

<===>
================================================================================
<===> preserved/unknown_variable/input.scss
a {b: abs(test)}

<===> preserved/unknown_variable/output.css
a {
b: abs(test);
}

<===>
================================================================================
<===> preserved/unquoted_string/input.scss
a {
b: abs(test);
}

<===> preserved/unquoted_string/output.css
a {
b: abs(test);
}

<===>
================================================================================
<===> named_argument/input.scss
a {b: abs($number: -3)}

<===> named_argument/output.css
a {
b: 3;
}
Expand All @@ -70,7 +147,7 @@ a {b: abs(-7px / 4em) * 1em}

<===> preserves_units/output.css
a {
b: 1.75em;
b: 1.75px;
}

<===>
Expand All @@ -79,26 +156,33 @@ a {
a {b: abs()}

<===> error/too_few_args/error
Error: Expected number, variable, function, or calculation.
,
Error: Missing argument $number.
,--> input.scss
1 | a {b: abs()}
| ^
| ^^^^^ invocation
'
,--> sass:math
1 | @function abs($number) {
| ============ declaration
'
input.scss 1:11 root stylesheet
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> error/too_many_args/input.scss
a {b: abs(1, 2)}


<===> error/too_many_args/error
Error: expected "+", "-", "*", "/", or ")".
,
Error: Only 1 argument allowed, but 2 were passed.
,--> input.scss
1 | a {b: abs(1, 2)}
| ^
| ^^^^^^^^^ invocation
'
,--> sass:math
1 | @function abs($number) {
| ============ declaration
'
input.scss 1:12 root stylesheet
input.scss 1:7 root stylesheet

<===>
================================================================================
Expand All @@ -107,16 +191,18 @@ a {b: abs(-7.5%)}

<===> abs_percentage_warning/output.css
a {
b: 7.5;
b: 7.5%;
}

<===> abs_percentage_warning/warning
DEPRECATION WARNING: Passing percentage units to the global abs() function is deprecated In the future, this will emit a CSS abs() function to be resolved by the browser.
DEPRECATION WARNING: Passing percentage units to the global abs() function is deprecated.
In the future, this will emit a CSS abs() function to be resolved by the browser.

To preserve current behavior:
math.abs(-7.5%)
To emit a CSS abs() now:
abs(#{-7.5%})
More info: https://sass-lang.com/d/abs-percent
More info: https://sass-lang.com/documentation/values/calculations#abs
,
1 | a {b: abs(-7.5%)}
| ^^^^^^^^^^^^^^^^^
Expand Down
Loading

0 comments on commit 33bf4be

Please sign in to comment.