Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Color 4] Add tests for is-missing() #1981

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
235 changes: 235 additions & 0 deletions spec/core_functions/color/is_missing.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<===> false/explicit/input.scss
@use 'sass:color';
a {b: color.is-missing(#abcdef, "red")}

<===> false/explicit/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/not_powerless/converted/non_legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(color.to-space(#aaaaab, lch), "hue")}

<===> false/not_powerless/converted/non_legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/not_powerless/converted/legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(color.to-space(#aaaaab, hsl), "hue")}

<===> false/not_powerless/converted/legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/not_powerless/direct/non_legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(lch(50% 1% 0deg), "hue")}

<===> false/not_powerless/direct/non_legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/not_powerless/direct/legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(hsl(0deg 50% 1%), "hue")}

<===> false/not_powerless/direct/legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/powerless/direct/non_legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(lch(50% 0% 0deg), "hue")}

<===> false/powerless/direct/non_legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/powerless/direct/legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(hsl(0deg 50% 0%), "hue")}

<===> false/powerless/direct/legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> false/powerless/converted/legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(color.to-space(#aaaaaa, hsl), "hue")}

<===> false/powerless/converted/legacy/output.css
a {
b: false;
}

<===>
================================================================================
<===> true/explicit/non_legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(lab(50% 30 none), "b")}

<===> true/explicit/non_legacy/output.css
a {
b: true;
}

<===>
================================================================================
<===> true/explicit/legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(rgb(none 30 100), "red")}

<===> true/explicit/legacy/output.css
a {
b: true;
}

<===>
================================================================================
<===> true/powerless/converted/non_legacy/input.scss
@use 'sass:color';
a {b: color.is-missing(color.to-space(#aaaaaa, lch), "hue")}

<===> true/powerless/converted/non_legacy/output.css
a {
b: true;
}

<===>
================================================================================
<===> named/input.scss
@use 'sass:color';
a {b: color.is-missing($color: black, $channel: "red")}

<===> named/output.css
a {
b: false;
}

<===>
================================================================================
<===> error/too_few_args/input.scss
@use 'sass:color';
a {b: color.is-missing(black)}

<===> error/too_few_args/error
Error: Missing argument $channel.
,--> input.scss
2 | a {b: color.is-missing(black)}
| ^^^^^^^^^^^^^^^^^^^^^^^ invocation
'
,--> sass:color
1 | @function is-missing($color, $channel) {
| ============================ declaration
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/too_many_args/input.scss
@use 'sass:color';
a {b: color.is-missing(black, "red", rgb)}

<===> error/too_many_args/error
Error: Only 2 arguments allowed, but 3 were passed.
,--> input.scss
2 | a {b: color.is-missing(black, "red", rgb)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation
'
,--> sass:color
1 | @function is-missing($color, $channel) {
| ============================ declaration
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/type/color/input.scss
@use 'sass:color';
a {b: color.is-missing("black", "red")}

<===> error/type/color/error
Error: $color: "black" is not a color.
,
2 | a {b: color.is-missing("black", "red")}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/type/channel/input.scss
@use 'sass:color';
a {b: color.is-missing(black, red)}

<===> error/type/channel/error
Error: $channel: red is not a string.
,
2 | a {b: color.is-missing(black, red)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/channel/wrong_space/input.scss
@use 'sass:color';
a {b: color.is-missing(black, "hue")}

<===> error/channel/wrong_space/error
Error: $channel: Color black doesn't have a channel named "hue".
,
2 | a {b: color.is-missing(black, "hue")}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/channel/unquoted/input.scss
@use 'sass:color';
a {b: color.is-missing(hsl(0deg 50% 50%), hue)}

<===> error/channel/unquoted/error
Error: $channel: Expected hue to be a quoted string.
,
2 | a {b: color.is-missing(hsl(0deg 50% 50%), hue)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> error/channel/wrong_case/input.scss
@use 'sass:color';
a {b: color.is-missing(black, "RED")}

<===> error/channel/wrong_case/error
Error: $channel: Color black doesn't have a channel named "RED".
,
2 | a {b: color.is-missing(black, "RED")}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet
14 changes: 14 additions & 0 deletions spec/core_functions/color/is_powerless/error.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ Error: $channel: Color black doesn't have a channel named "hue".
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> channel/wrong_case/input.scss
@use 'sass:color';
a {b: color.is-powerless(black, "RED")}

<===> channel/wrong_case/error
Error: $channel: Color black doesn't have a channel named "RED".
,
2 | a {b: color.is-powerless(black, "RED")}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> space/quoted/input.scss
Expand Down
Loading