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 tests for the indented syntax #2034

Merged
merged 6 commits into from
Nov 4, 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
54 changes: 54 additions & 0 deletions spec/arguments/invocation.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,57 @@ Error: Positional arguments must come before keyword arguments.
| ^
'
input.scss 3:14 root stylesheet

<===>
================================================================================
<===> function/error/sass/multi-line-arguments/declaration/input.sass
@function a(
$b,
$c
)
@return d

e
f: a(g, h)

<===> function/error/sass/multi-line-arguments/declaration/error
Error: expected ")".
,
1 | @function a(
| ^
'
input.sass 1:13 root stylesheet

<===>
================================================================================
<===> function/error/sass/multi-line-arguments/invocation/input.sass
@function a($b, $c)
@return d

e
f: a(
g,
h
)

<===> function/error/sass/multi-line-arguments/invocation/error
Error: expected ")".
,
5 | f: a(
| ^
'
input.sass 5:8 root stylesheet

<===>
================================================================================
<===> function/arguments/sass/input.sass
@function a($b, $c)
@return d

e
f: a(g, h)

<===> function/arguments/sass/output.css
e {
f: d;
}
109 changes: 97 additions & 12 deletions spec/css/custom_properties/trailing_whitespace.hrx
Original file line number Diff line number Diff line change
@@ -1,16 +1,101 @@
<===> input.scss
.trailing-whitespace {
--space: value ;
--tab: value ;
--newline: value
<===> scss/space/input.scss
a {
--b: c ;
}

<===> scss/space/output.css
a {
--b: c ;
}

<===>
================================================================================
<===> scss/tab/input.scss
a {
--b: c ;
}

<===> scss/tab/output.css
a {
--b: c ;
}

<===>
================================================================================
<===> scss/newline/input.scss
a {
--b: c
;
--before-closing-brace: value
}

<===> output.css
.trailing-whitespace {
--space: value ;
--tab: value ;
--newline: value ;
--before-closing-brace: value ;
<===> scss/newline/output.css
a {
--b: c ;
}

<===>
================================================================================
<===> scss/before-closing-brace/input.scss
a {
--b: c
}

<===> scss/before-closing-brace/output.css
a {
--b: c ;
}

<===>
================================================================================
<===> sass/space/input.sass
a
--b: c

<===> sass/space/output.css
a {
--b: c;
}

<===>
================================================================================
<===> sass/tab/input.sass
a
--b: c

<===> sass/tab/output.css
a {
--b: c;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this behavior currently differs between the syntaxes- in a custom property, trailing whitespace is removed in Indented and condensed in Scss (see line 20).

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a design conflict here between "trailing whitespace in custom property values is observable in CSS" and "end-of-line trailing whitespaces is invisible and generally shouldn't matter", complicated further by the fact that custom property trailing whitespace nearly never matters in practice. I think given that we're planning to allow --b: c ; in the indented syntax eventually anyway, preserving the existing behavior is probably the right way forward.


<===>
================================================================================
<===> sass/newline/input.sass
a
--b: c

--d: e


<===> sass/newline/output.css
a {
--b: c;
--d: e;
}

<===>
================================================================================
<===> sass/before-block-end/input.sass
a
--b: c

d
--e: f

<===> sass/before-block-end/output.css
a {
--b: c;
}

d {
--e: f;
}
150 changes: 148 additions & 2 deletions spec/css/custom_properties/value_interpolation.hrx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<===> input.scss
<===> scss/value-interpolation/input.scss
.value-interpolation {
// Interpolation is the only Sass construct that's supported in custom
// variables.
Expand All @@ -9,11 +9,157 @@
--in-uri: uri(foo#{1 + 2}bar);
}

<===> output.css
<===> scss/value-interpolation/output.css
.value-interpolation {
--alone: 3;
--in-list: a 3 c;
--in-ident: foo3bar;
--in-string: "foo3bar";
--in-uri: uri(foo3bar);
}

<===>
================================================================================
<===> scss/alone/input.scss
a{
--b: #{1 + 2};
}

<===> scss/alone/output.css
a {
--b: 3;
}

<===>
================================================================================
<===> scss/in-list/input.scss
a{
--b: c #{1 + 2} d;
}

<===> scss/in-list/output.css
a {
--b: c 3 d;
}

<===>
================================================================================
<===> scss/in-string/input.scss
a{
--b: "c#{1 + 2}d";
}

<===> scss/in-string/output.css
a {
--b: "c3d";
}

<===>
================================================================================
<===> scss/in-ident/input.scss
a{
--b: c#{1 + 2}d;
}

<===> scss/in-ident/output.css
a {
--b: c3d;
}

<===>
================================================================================
<===> scss/in-uri/input.scss
a{
--b: uri(c#{1 + 2}d);
}

<===> scss/in-uri/output.css
a {
--b: uri(c3d);
}

<===>
================================================================================
<===> scss/linebreak-interpolation/input.scss
a{
--b: #{1
+
2};
}

<===> scss/linebreak-interpolation/output.css
a {
--b: 3;
}

<===>
================================================================================
<===> sass/alone/input.sass
a
--b: #{1 + 2}

<===> sass/alone/output.css
a {
--b: 3;
}

<===>
================================================================================
<===> sass/in-list/input.sass
a
--b: c #{1 + 2} d

<===> sass/in-list/output.css
a {
--b: c 3 d;
}

<===>
================================================================================
<===> sass/in-string/input.sass
a
--b: "c#{1 + 2}d"

<===> sass/in-string/output.css
a {
--b: "c3d";
}

<===>
================================================================================
<===> sass/in-ident/input.sass
a
--b: c#{1 + 2}d

<===> sass/in-ident/output.css
a {
--b: c3d;
}

<===>
================================================================================
<===> sass/in-uri/input.sass
a
--b: uri(c#{1 + 2}d)

<===> sass/in-uri/output.css
a {
--b: uri(c3d);
}

<===>
================================================================================
<===> error/sass/linebreak-interpolation/input.sass
a
--b: #{1
+
2}


<===> error/sass/linebreak-interpolation/error
Error: expected "}".
,
2 | --b: #{1
| ^
'
input.sass 2:12 root stylesheet
Loading
Loading