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 comments in more expression-like contexts #2000

Merged
merged 1 commit into from
Jun 20, 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
184 changes: 184 additions & 0 deletions spec/css/functions/special.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,187 @@ a {b: -a-calc(#{0})}
a {
b: -a-calc(0);
}

<===>
================================================================================
<===> comment/calc/after_open_paren/loud/input.scss
a {b: -a-calc(/**/ c)}

<===> comment/calc/after_open_paren/loud/output.css
a {
b: -a-calc(/**/ c);
}

<===>
================================================================================
<===> comment/calc/after_open_paren/silent/input.scss
a {
b: -a-calc(//
c);
}

<===> comment/calc/after_open_paren/silent/output.css
a {
b: -a-calc( c);
}

<===>
================================================================================
<===> comment/calc/before_close_paren/loud/input.scss
a {b: -a-calc(c /**/)}

<===> comment/calc/before_close_paren/loud/output.css
a {
b: -a-calc(c /**/);
}

<===>
================================================================================
<===> comment/calc/before_close_paren/silent/input.scss
a {
b: -a-calc(c //
);
}

<===> comment/calc/before_close_paren/silent/output.css
a {
b: -a-calc(c );
}

<===>
================================================================================
<===> comment/element/after_open_paren/loud/input.scss
a {b: element(/**/ c)}

<===> comment/element/after_open_paren/loud/output.css
a {
b: element(/**/ c);
}

<===>
================================================================================
<===> comment/element/after_open_paren/silent/input.scss
a {
b: element(//
c);
}

<===> comment/element/after_open_paren/silent/output.css
a {
b: element( c);
}

<===>
================================================================================
<===> comment/element/before_close_paren/loud/input.scss
a {b: element(c /**/)}

<===> comment/element/before_close_paren/loud/output.css
a {
b: element(c /**/);
}

<===>
================================================================================
<===> comment/element/before_close_paren/silent/input.scss
a {
b: element(c //
);
}

<===> comment/element/before_close_paren/silent/output.css
a {
b: element(c );
}

<===>
================================================================================
<===> comment/expression/after_open_paren/loud/input.scss
a {b: expression(/**/ c)}

<===> comment/expression/after_open_paren/loud/output.css
a {
b: expression(/**/ c);
}

<===>
================================================================================
<===> comment/expression/after_open_paren/silent/input.scss
a {
b: expression(//
c);
}

<===> comment/expression/after_open_paren/silent/output.css
a {
b: expression( c);
}

<===>
================================================================================
<===> comment/expression/before_close_paren/loud/input.scss
a {b: expression(c /**/)}

<===> comment/expression/before_close_paren/loud/output.css
a {
b: expression(c /**/);
}

<===>
================================================================================
<===> comment/expression/before_close_paren/silent/input.scss
a {
b: expression(c //
);
}

<===> comment/expression/before_close_paren/silent/output.css
a {
b: expression(c );
}

<===>
================================================================================
<===> comment/progid/after_open_paren/loud/input.scss
a {b: progid:c(/**/ d)}

<===> comment/progid/after_open_paren/loud/output.css
a {
b: progid:c(/**/ d);
}

<===>
================================================================================
<===> comment/progid/after_open_paren/silent/input.scss
a {
b: progid:c(//
d);
}

<===> comment/progid/after_open_paren/silent/output.css
a {
b: progid:c( d);
}

<===>
================================================================================
<===> comment/progid/before_close_paren/loud/input.scss
a {b: progid:c(d /**/)}

<===> comment/progid/before_close_paren/loud/output.css
a {
b: progid:c(d /**/);
}

<===>
================================================================================
<===> comment/progid/before_close_paren/silent/input.scss
a {
b: progid:c(d //
Copy link
Member

Choose a reason for hiding this comment

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

If there are multiple lines with //, are they considered a single silent comment, or multiple silent comments?

For example, would this block:

a {
  b: progid:c(d // foo
                // bar
    );
}

result in this?:

a {
  b: progid:c(d

    );
}

And if so, is that OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are not considered a single comment, but the whitespace around them is still considered "adjacent" so you won't end up with multiple newlines.

);
}

<===> comment/progid/before_close_paren/silent/output.css
a {
b: progid:c(d );
}
10 changes: 8 additions & 2 deletions spec/css/style_rule.hrx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<===> comment/after_selector/loud/input.scss
a /**/ {}
a /**/ {b: c}

<===> comment/after_selector/loud/output.css
a {
b: c;
}

<===>
================================================================================
<===> comment/after_selector/silent/input.scss
a //
{}
{b: c}

<===> comment/after_selector/silent/output.css
a {
b: c;
}

<===>
================================================================================
Expand Down
Loading
Loading