Skip to content

Commit

Permalink
Add wpt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelalozano16 committed Aug 2, 2023
1 parent d59f6ad commit 11ddcde
Show file tree
Hide file tree
Showing 8 changed files with 1,062 additions and 352 deletions.
62 changes: 62 additions & 0 deletions spec/values/calculation/mod.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ a {
b: mod(1px, 2bar);
}

<===>
================================================================================
<===> equals/input.scss
a {b: mod(1, 1)}

<===> equals/output.css
a {
b: 0;
}

<===>
================================================================================
<===> positive_and_negative/input.scss
Expand Down Expand Up @@ -322,3 +332,55 @@ Error: expected "+", "-", "*", "/", ",", or ")".
| ^
'
input.scss 1:13 root stylesheet

<===>
================================================================================
<===> math/unknown_units/input.scss
a {
b: mod(1px + 0%, 1px + 0%);
}

<===> math/unknown_units/output.css
a {
b: mod(1px + 0%, 1px + 0%);
}

<===>
================================================================================
<===> NaN/negative_zero_and_positive_infinity/input.scss
a {b: mod(-0, infinity)}

<===> NaN/negative_zero_and_positive_infinity/output.css
a {
b: calc(NaN);
}

<===>
================================================================================
<===> NaN/zero_and_negative_infinity/input.scss
a {b: mod(0, -infinity)}

<===> NaN/zero_and_negative_infinity/output.css
a {
b: calc(NaN);
}

<===>
================================================================================
<===> NaN/negative_and_positive_infinity/input.scss
a {b: mod(-5, infinity)}

<===> NaN/negative_and_positive_infinity/output.css
a {
b: calc(NaN);
}

<===>
================================================================================
<===> NaN/positive_and_negative_infinity/input.scss
a {b: mod(5, -infinity)}

<===> NaN/positive_and_negative_infinity/output.css
a {
b: calc(NaN);
}
64 changes: 64 additions & 0 deletions spec/values/calculation/rem.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ a {
b: rem(1px, 2bar);
}

<===>
================================================================================
<===> equals/input.scss
a {b: rem(1, 1)}

<===> equals/output.css
a {
b: 0;
}

<===>
================================================================================
<===> positive_and_negative/input.scss
Expand Down Expand Up @@ -322,3 +332,57 @@ Error: expected "+", "-", "*", "/", ",", or ")".
| ^
'
input.scss 1:13 root stylesheet

<===>
================================================================================
<===> math/unknown_units/input.scss
a {
b: rem(1px + 0%, 1px + 0%);
}

<===> math/unknown_units/output.css
a {
b: rem(1px + 0%, 1px + 0%);
}

<===>
================================================================================
<===> negative_zero_and_positive_infinity/input.scss
@use "sass:math";
a {b: math.div(1, rem(-0, infinity))}

<===> negative_zero_and_positive_infinity/output.css
a {
b: calc(-infinity);
}

<===>
================================================================================
<===> zero_and_negative_infinity/input.scss
@use "sass:math";
a {b: math.div(1, rem(0, -infinity))}

<===> zero_and_negative_infinity/output.css
a {
b: calc(infinity);
}

<===>
================================================================================
<===> negative_and_positive_infinity/input.scss
a {b: rem(-5, infinity)}

<===> negative_and_positive_infinity/output.css
a {
b: -5;
}

<===>
================================================================================
<===> positive_and_negative_infinity/input.scss
a {b: rem(5, -infinity)}

<===> positive_and_negative_infinity/output.css
a {
b: 5;
}
197 changes: 197 additions & 0 deletions spec/values/calculation/round/strategies/down.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<===> README.md
Most of the same behavior tested for `calc()` applies to `round()`, but for
terseness' sake isn't tested explicitly.

<===>
================================================================================
<===> strategy/down/step_is_multiple_of_number/input.scss
a {b: round(down, 5px, 25px)}

<===> strategy/down/step_is_multiple_of_number/output.css
a {
b: 0px;
}

<===>
================================================================================
<===> strategy/down/number_is_multiple_of_step/input.scss
a {b: round(down, 25px, 5px)}

<===> strategy/down/number_is_multiple_of_step/output.css
a {
b: 25px;
}

<===>
================================================================================
<===> strategy/down/positive/input.scss
a {b: round(down, 122px, 25px)}

<===> strategy/down/positive/output.css
a {
b: 100px;
}

<===>
================================================================================
<===> strategy/down/negative/input.scss
a {b: round(down, -101, -25)}

<===> strategy/down/negative/output.css
a {
b: -125;
}

<===>
================================================================================
<===> strategy/down/negative_step/input.scss
a {b: round(down, 12, -7)}

<===> strategy/down/negative_step/output.css
a {
b: 7;
}

<===>
================================================================================
<===> strategy/down/infinity/input.scss
a {b: round(down, infinity, infinity)}

<===> strategy/down/infinity/output.css
a {
b: calc(NaN);
}

<===>
================================================================================
<===> strategy/down/step_is_zero/input.scss
a {b: round(down, 10px, 0px)}

<===> strategy/down/step_is_zero/output.css
a {
b: calc(NaN * 1px);
}

<===>
================================================================================
<===> strategy/down/positive_and_infinity/input.scss
@use "sass:math";
a {b: math.div(1, round(down, 10, infinity))}

<===> strategy/down/positive_and_infinity/output.css
a {
b: calc(infinity);
}

<===>
================================================================================
<===> strategy/down/negative_and_infinity/input.scss
@use "sass:math";
a {b: round(down, -10, infinity)}

<===> strategy/down/negative_and_infinity/output.css
a {
b: calc(-infinity);
}

<===>
================================================================================
<===> strategy/down/upper_multiple/number_is_bigger/input.scss
a {b: round(down, 23px, 10px)}

<===> strategy/down/upper_multiple/number_is_bigger/output.css
a {
b: 20px;
}

<===>
================================================================================
<===> strategy/down/upper_multiple/number_is_smaller/input.scss
a {b: round(down, 18px, 10px)}

<===> strategy/down/upper_multiple/number_is_smaller/output.css
a {
b: 10px;
}

<===>
================================================================================
<===> strategy/down/upper_multiple/number_is_half/input.scss
a {b: round(down, 15px, 10px)}

<===> strategy/down/upper_multiple/number_is_half/output.css
a {
b: 10px;
}

<===>
================================================================================
<===> strategy/down/upper_multiple/number_is_negative/input.scss
a {b: round(down, -13px, 10px)}

<===> strategy/down/upper_multiple/number_is_negative/output.css
a {
b: -20px;
}

<===>
================================================================================
<===> strategy/down/lower_multiple/number_is_bigger/input.scss
a {b: round(down, 13px, 10px)}

<===> strategy/down/lower_multiple/number_is_bigger/output.css
a {
b: 10px;
}

<===>
================================================================================
<===> strategy/down/lower_multiple/number_is_negative/input.scss
a {b: round(down, -18px, 10px)}

<===> strategy/down/lower_multiple/number_is_negative/output.css
a {
b: -20px;
}

<===>
================================================================================
<===> strategy/down/negative_zero/positive_infinity/input.scss
@use "sass:math";
a {b: math.div(1, round(down, -1 * 0, infinity))}

<===> strategy/down/negative_zero/positive_infinity/output.css
a {
b: calc(-infinity);
}

<===>
================================================================================
<===> strategy/down/positive_zero/zero/input.scss
@use "sass:math";
a {b: math.div(1, round(down, 0, infinity))}

<===> strategy/down/positive_zero/zero/output.css
a {
b: calc(infinity);
}

<===>
================================================================================
<===> strategy/down/positive_zero/one/input.scss
a {b: round(down, 1, infinity)}

<===> strategy/down/positive_zero/one/output.css
a {
b: calc(infinity);
}

<===>
================================================================================
<===> strategy/down/nested_function/input.scss
a {b: round(down, round(100, 10) + 2 * 3, 10)}

<===> strategy/down/nested_function/output.css
a {
b: 100;
}
Loading

0 comments on commit 11ddcde

Please sign in to comment.