Skip to content

Commit

Permalink
Update specs to preserve the location of trailing loud comments (#1485)
Browse files Browse the repository at this point in the history
See Issue sass/dart-sass#417 
See PR sass/dart-sass#849

Co-authored-by: Carlos Israel Ortiz García <goodwine@google.com>
Co-Authored-By: Natalie Weizenbaum <nweiz@google.com>
  • Loading branch information
nex3 and Goodwine committed Jun 3, 2022
1 parent c3ee83b commit af752b0
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 6 deletions.
3 changes: 3 additions & 0 deletions spec/css/keyframes.hrx
Expand Up @@ -28,6 +28,9 @@ a {
}

<===> bubble/empty/output.css
@keyframes { /**/ }

<===> bubble/empty/output-libsass.css
@keyframes {
/**/
}
Expand Down
19 changes: 19 additions & 0 deletions spec/directives/use/css/order.hrx
Expand Up @@ -451,6 +451,25 @@ a {file: midstream}

<===> import_order/comments_and_imports/output.css
/* upstream comment before import */
@import "upstream.css";
/* midstream comment before use */
/* midstream comment before first import */
@import "midstream1.css";
/* midstream comment before second import */
@import "midstream2.css";
/* input comment before use */
/* input comment before import */
@import "input.css";
/* upstream comment after import */
/* midstream comment after imports */
a {
file: midstream;
}

/* input comment after import */

<===> import_order/comments_and_imports/output-libsass.css
/* upstream comment before import */

@import "upstream.css";

Expand Down
7 changes: 7 additions & 0 deletions spec/libsass-closed-issues/issue_1007.hrx
Expand Up @@ -4,6 +4,13 @@
} /* end */
<===> output.css
/* start */
foo baz {
/* before */
margin: 0; /* after */
} /* end */

<===> output-libsass.css
/* start */
foo baz {
/* before */
margin: 0;
Expand Down
8 changes: 8 additions & 0 deletions spec/libsass-closed-issues/issue_1294.hrx
Expand Up @@ -11,6 +11,14 @@ foo {
/*------------------------------------*\
#BUTTONS
\*------------------------------------*/
foo {
display: inline-block; /* [1] */
}

<===> output-libsass.css
/*------------------------------------*\
#BUTTONS
\*------------------------------------*/
foo {
display: inline-block;
/* [1] */
Expand Down
8 changes: 8 additions & 0 deletions spec/libsass-closed-issues/issue_1567.hrx
Expand Up @@ -7,6 +7,14 @@

<===> output.css
/* any */
@media screen, not print { /* whatever */
body {
line-height: 1.2;
}
}

<===> output-libsass.css
/* any */
@media screen, not print {
/* whatever */
body {
Expand Down
4 changes: 1 addition & 3 deletions spec/libsass-closed-issues/issue_894.hrx
Expand Up @@ -2,9 +2,7 @@
a {/**/}
b {content: 'something so I have a non-empty expected output'}
<===> output.css
a {
/**/
}
a { /**/ }

b {
content: "something so I have a non-empty expected output";
Expand Down
6 changes: 6 additions & 0 deletions spec/libsass-closed-issues/issue_941.hrx
Expand Up @@ -6,6 +6,12 @@

<===> output.css
.one,
.two { /* 3 */
color: #F00; /* 4 */
}

<===> output-libsass.css
.one,
.two {
/* 3 */
color: #F00;
Expand Down
56 changes: 53 additions & 3 deletions spec/non_conformant/basic/06_nesting_and_comments.hrx
Expand Up @@ -25,18 +25,18 @@ div {
bloo: bloo;
}
}
p {
p { /* comment after open brace goes in */
padding: 10px 8%;
-webkit-box-sizing: $blux;
}
} /* comment after close brace goes out */
margin: 10px 5px;
h1 {
color: $blip;
}
}
/* last comment, top level again --
compare the indentation! */

div {
f: g;
empty {
Expand All @@ -58,6 +58,55 @@ div {
color: red;
background: blue;
/* the next selector should be indented two spaces */
/* comment after close brace goes out */
margin: 10px 5px;
}
div span {
font-weight: bold;
/* yet another comment that should be preserved */
display: inline-block;
}
div span a {
text-decoration: none; /* where will this comment go? */
color: green;
/* what about this comment? */
border: 1px bloo blee red;
}
div empty not_empty {
blah: blah;
bloo: bloo;
}
div p { /* comment after open brace goes in */
padding: 10px 8%;
-webkit-box-sizing: hux;
}
div h1 {
color: "a 'red' and \"blue\" value";
}

/* last comment, top level again --
compare the indentation! */
div {
f: g;
}
div empty span {
a: b;
}
div empty_with_comment {
/* hey now */
}
div empty_with_comment span {
c: d;
}

<===> output-libsass.css
/* top level comment -- should be preserved */
div {
/* another comment that should be preserved */
color: red;
background: blue;
/* the next selector should be indented two spaces */
/* comment after close brace goes out */
margin: 10px 5px;
}
div span {
Expand All @@ -77,6 +126,7 @@ div empty not_empty {
bloo: bloo;
}
div p {
/* comment after open brace goes in */
padding: 10px 8%;
-webkit-box-sizing: hux;
}
Expand Down

0 comments on commit af752b0

Please sign in to comment.