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

Add specs for @forward ... with #1499

Merged
merged 3 commits into from
Dec 20, 2019
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
27 changes: 20 additions & 7 deletions spec/core_functions/meta/load_css/error.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("other", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
Expand All @@ -138,7 +137,6 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("other", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
Expand All @@ -160,7 +158,6 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("midstream", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
Expand All @@ -178,7 +175,6 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("other", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
Expand Down Expand Up @@ -410,7 +406,6 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("used", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
Expand All @@ -431,7 +426,6 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("used", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
Expand All @@ -452,7 +446,26 @@ Error: $a was not declared with !default in the @used module.
2 | @include meta.load-css("used", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 load-css()
input.scss 2:1 root stylesheet

<===>
================================================================================
<===> with/through_forward/with/input.scss
@use "sass:meta";
@include meta.load-css("used", $with: (a: b));

<===> with/through_forward/with/_used.scss
@forward "forwarded" with ($a: c);

<===> with/through_forward/with/_forwarded.scss
$a: d !default;

<===> with/through_forward/with/error
Error: $a was not declared with !default in the @used module.
,
2 | @include meta.load-css("used", $with: (a: b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:1 root stylesheet

<===>
Expand Down
62 changes: 61 additions & 1 deletion spec/core_functions/meta/load_css/with.hrx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<===> README.md
Most changes here should also be reflected in directives/use/with.hrx.
Most changes here should also be reflected in directives/use/with.hrx and
directives/forward/with.hrx.

<===> empty/input.scss
@use "sass:meta";
Expand Down Expand Up @@ -207,6 +208,65 @@ b {
c: configured;
}

<===>
================================================================================
<===> through_forward/with/default/input.scss
@use "sass:meta";
@include meta.load-css("loaded", $with: (a: from input));

<===> through_forward/with/default/_loaded.scss
@forward "forwarded" with ($a: from loaded !default);

<===> through_forward/with/default/_forwarded.scss
$a: from forwarded !default;
b {c: $a}

<===> through_forward/with/default/output.css
b {
c: from input;
}

<===>
================================================================================
<===> through_forward/with/null/input.scss
@use "sass:meta";
@include meta.load-css("loaded", $with: (a: null));

<===> through_forward/with/null/_loaded.scss
@forward "forwarded" with ($a: from loaded !default);

<===> through_forward/with/null/_forwarded.scss
$a: from forwarded !default;
b {c: $a}

<===> through_forward/with/null/output.css
b {
c: from loaded;
}

<===>
================================================================================
<===> through_forward/with/unconfigured/input.scss
@use "sass:meta";
@include meta.load-css("loaded", $with: (a: from input));

<===> through_forward/with/unconfigured/_loaded.scss
@forward "forwarded" with ($b: from loaded);

<===> through_forward/with/unconfigured/_forwarded.scss
$a: from forwarded !default;
$b: from forwarded !default;
c {
a: $a;
b: $b;
}

<===> through_forward/with/unconfigured/output.css
c {
a: from input;
b: from loaded;
}

<===>
================================================================================
<===> through_forward/show/input.scss
Expand Down
130 changes: 130 additions & 0 deletions spec/directives/forward/error/syntax.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,133 @@ Error: @forward rules must be written before any other rules.
| ^^^^^^^^^^^^
'
input.sass 2:1 root stylesheet

<===>
================================================================================
<===> with/empty/input.scss
@forward "other" with ();

<===> with/empty/error
Error: expected "$".
,
1 | @forward "other" with ();
| ^
'
input.scss 1:24 root stylesheet

<===>
================================================================================
<===> with/missing_keyword/input.scss
@forward "other" with (a);

<===> with/missing_keyword/error
Error: expected "$".
,
1 | @forward "other" with (a);
| ^
'
input.scss 1:24 root stylesheet

<===>
================================================================================
<===> with/missing_value/input.scss
@forward "other" with ($a);

<===> with/missing_value/error
Error: expected ":".
,
1 | @forward "other" with ($a);
| ^
'
input.scss 1:26 root stylesheet

<===>
================================================================================
<===> with/space_after_dollar/input.scss
@forward "other" with ($ a: b);

<===> with/space_after_dollar/error
Error: Expected identifier.
,
1 | @forward "other" with ($ a: b);
| ^
'
input.scss 1:25 root stylesheet

<===>
================================================================================
<===> with/namespace_variable/input.scss
@forward "other" with (a.$b: c);

<===> with/namespace_variable/error
Error: expected "$".
,
1 | @forward "other" with (a.$b: c);
| ^
'
input.scss 1:24 root stylesheet

<===>
================================================================================
<===> with/extra_comma/input.scss
@forward "other" with ($a: b,,);

<===> with/extra_comma/error
Error: expected ")".
,
1 | @forward "other" with ($a: b,,);
| ^
'
input.scss 1:30 root stylesheet

<===>
================================================================================
<===> with/no_arguments/input.scss
@forward "other" with;

<===> with/no_arguments/error
Error: expected "(".
,
1 | @forward "other" with;
| ^
'
input.scss 1:22 root stylesheet

<===>
================================================================================
<===> with/before_as/input.scss
@forward "other" with ($a: b) as c-*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is the same with @use currently - but I don’t see it documented clearly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<===> with/before_as/input.scss
@use "other" with ($a: b) as c;
<===> with/before_as/error
Error: expected ";".
,
1 | @use "other" with ($a: b) as c;
| ^
'
input.scss 1:27 root stylesheet

😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha - I guess I was referring to user-facing documentation that these phrases have a set order :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, user-facing documentation is not 100% thorough—we gloss over some details that are unlikely to matter in order to keep it readable and beginner-friendly. The prose specification is where you should look for the most thorough and rigorous documentation, and it's also clear about this.


<===> with/before_as/error
Error: expected ";".
,
1 | @forward "other" with ($a: b) as c-*;
| ^
'
input.scss 1:31 root stylesheet

<===>
================================================================================
<===> with/before_show/input.scss
@forward "other" with ($a: b) show c;

<===> with/before_show/error
Error: expected ";".
,
1 | @forward "other" with ($a: b) show c;
| ^
'
input.scss 1:31 root stylesheet

<===>
================================================================================
<===> with/before_hide/input.scss
@forward "other" with ($a: b) hide c;

<===> with/before_hide/error
Error: expected ";".
,
1 | @forward "other" with ($a: b) hide c;
| ^
'
input.scss 1:31 root stylesheet
Loading