Skip to content

Commit

Permalink
Add better tests for the bounds of legacy color space constructors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 authored Apr 12, 2024
1 parent d1f052b commit c895d27
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 72 deletions.
54 changes: 54 additions & 0 deletions spec/core_functions/color/hsl/three_args/bounds.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<===> README.md
The W3C tests cover out-of-bounds hue, but not saturation or lightness.

<===>
================================================================================
<===> saturation/above/input.scss
@use 'core_functions/color/utils';
@include utils.inspect(hsl(0, 200%, 50%));

<===> saturation/above/output.css
a {
value: hsl(0, 200%, 50%);
space: hsl;
channels: 0deg 200% 50% / 1;
}

<===>
================================================================================
<===> saturation/below/input.scss
@use 'core_functions/color/utils';
@include utils.inspect(hsl(0, -100%, 50%));

<===> saturation/below/output.css
a {
value: hsl(0, 0%, 50%);
space: hsl;
channels: 0deg 0% 50% / 1;
}

<===>
================================================================================
<===> lightness/above/input.scss
@use 'core_functions/color/utils';
@include utils.inspect(hsl(0, 100%, 500%));

<===> lightness/above/output.css
a {
value: hsl(0, 100%, 500%);
space: hsl;
channels: 0deg 100% 500% / 1;
}

<===>
================================================================================
<===> lightness/below/input.scss
@use 'core_functions/color/utils';
@include utils.inspect(hsl(0, 100%, -100%));

<===> lightness/below/output.css
a {
value: hsl(0, 100%, -100%);
space: hsl;
channels: 0deg 100% -100% / 1;
}
32 changes: 0 additions & 32 deletions spec/core_functions/color/hsl/three_args/clamped.hrx

This file was deleted.

221 changes: 221 additions & 0 deletions spec/core_functions/color/hwb/three_args/bounds.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
<===> whiteness/above/blackness/zero/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 150%, 0%));

<===> whiteness/above/blackness/zero/output.css
a {
value: white;
space: hwb;
channels: 0deg 100% 0% / 1;
}

<===>
================================================================================
<===> whiteness/above/blackness/mid/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 150%, 10%));

<===> whiteness/above/blackness/mid/output.css
a {
value: hsl(0, 0%, 93.75%);
space: hwb;
channels: 0deg 93.75% 6.25% / 1;
}

<===>
================================================================================
<===> whiteness/above/blackness/above/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 150%, 120%));

<===> whiteness/above/blackness/above/output.css
a {
value: hsl(0, 0%, 55.5555555556%);
space: hwb;
channels: 0deg 55.5555555556% 44.4444444444% / 1;
}

<===>
================================================================================
<===> whiteness/above/blackness/below/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 150%, -20%));

<===> whiteness/above/blackness/below/output.css
a {
value: hsl(0, 0%, 115.3846153846%);
space: hwb;
channels: 0deg 115.3846153846% -15.3846153846% / 1;
}

<===>
================================================================================
<===> whiteness/below/blackness/zero/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, -50%, 0%));

<===> whiteness/below/blackness/zero/output.css
a {
value: hsl(0, 300%, 25%);
space: hwb;
channels: 0deg -50% 0% / 1;
}

<===>
================================================================================
<===> whiteness/below/blackness/mid/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, -50%, 10%));

<===> whiteness/below/blackness/mid/output.css
a {
value: hsl(0, 350%, 20%);
space: hwb;
channels: 0deg -50% 10% / 1;
}

<===>
================================================================================
<===> whiteness/below/blackness/above/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, -50%, 120%));

<===> whiteness/below/blackness/above/output.css
a {
value: hsl(180, 42.8571428571%, -35%);
space: hwb;
channels: 0deg -50% 120% / 1;
}

<===>
================================================================================
<===> whiteness/below/blackness/below/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, -50%, -20%));

<===> whiteness/below/blackness/below/output.css
a {
value: hsl(0, 242.8571428571%, 35%);
space: hwb;
channels: 0deg -50% -20% / 1;
}

<===>
================================================================================
<===> blackness/above/whiteness/zero/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 0%, 150%));

<===> blackness/above/whiteness/zero/output.css
a {
value: black;
space: hwb;
channels: 0deg 0% 100% / 1;
}

<===>
================================================================================
<===> blackness/above/whiteness/mid/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 10%, 150%));

<===> blackness/above/whiteness/mid/output.css
a {
value: hsl(0, 0%, 6.25%);
space: hwb;
channels: 0deg 6.25% 93.75% / 1;
}

<===>
================================================================================
<===> blackness/above/whiteness/above/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 120%, 150%));

<===> blackness/above/whiteness/above/output.css
a {
value: hsl(0, 0%, 44.4444444444%);
space: hwb;
channels: 0deg 44.4444444444% 55.5555555556% / 1;
}

<===>
================================================================================
<===> blackness/above/whiteness/below/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, -20%, 150%));

<===> blackness/above/whiteness/below/output.css
a {
value: hsl(0, 0%, -15.3846153846%);
space: hwb;
channels: 0deg -15.3846153846% 115.3846153846% / 1;
}

<===>
================================================================================
<===> blackness/below/whiteness/zero/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 0%, -50%));

<===> blackness/below/whiteness/zero/output.css
a {
value: hsl(0, 300%, 75%);
space: hwb;
channels: 0deg 0% -50% / 1;
}

<===>
================================================================================
<===> blackness/below/whiteness/mid/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 10%, -50%));

<===> blackness/below/whiteness/mid/output.css
a {
value: hsl(0, 350%, 80%);
space: hwb;
channels: 0deg 10% -50% / 1;
}

<===>
================================================================================
<===> blackness/below/whiteness/above/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, 120%, -50%));

<===> blackness/below/whiteness/above/output.css
a {
value: hsl(180, 42.8571428571%, 135%);
space: hwb;
channels: 0deg 120% -50% / 1;
}

<===>
================================================================================
<===> blackness/below/whiteness/below/input.scss
@use 'sass:color';
@use 'core_functions/color/utils';
@include utils.inspect(color.hwb(0, -20%, -50%));

<===> blackness/below/whiteness/below/output.css
a {
value: hsl(0, 242.8571428571%, 65%);
space: hwb;
channels: 0deg -20% -50% / 1;
}
Loading

0 comments on commit c895d27

Please sign in to comment.