From e3c74af10a0cd853c39eb4e63901635b39dd72f2 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 17 Jun 2024 13:41:50 -0700 Subject: [PATCH] Add tests for comments around statements (#1998) A few of these cases are currently broken on Dart Sass. --- spec/css/media/comment.hrx | 27 ++++ spec/css/moz_document/comment.hrx | 71 +++++++++ spec/css/propset.hrx | 45 ++++++ spec/css/style_rule.hrx | 75 ++++++++++ spec/css/supports/comment.hrx | 27 ++++ spec/css/unknown_directive/comment.hrx | 113 ++++++++++++++ spec/directives/at_root.hrx | 105 +++++++++++++ spec/directives/extend/comment.hrx | 62 ++++++++ spec/directives/for.hrx | 90 ++++++++++++ spec/directives/forward/comment.hrx | 194 +++++++++++++++++++++++++ spec/directives/function.hrx | 61 ++++++++ spec/directives/if/comment.hrx | 95 ++++++++++++ spec/directives/import/comment.hrx | 68 +++++++++ spec/directives/mixin.hrx | 179 +++++++++++++++++++++++ spec/directives/use/comment.hrx | 194 +++++++++++++++++++++++++ spec/directives/warn.hrx | 45 ++++++ spec/variables.hrx | 44 ++++++ 17 files changed, 1495 insertions(+) create mode 100644 spec/css/media/comment.hrx create mode 100644 spec/css/moz_document/comment.hrx create mode 100644 spec/css/style_rule.hrx create mode 100644 spec/css/supports/comment.hrx create mode 100644 spec/css/unknown_directive/comment.hrx create mode 100644 spec/directives/extend/comment.hrx create mode 100644 spec/directives/forward/comment.hrx create mode 100644 spec/directives/if/comment.hrx create mode 100644 spec/directives/import/comment.hrx create mode 100644 spec/directives/use/comment.hrx diff --git a/spec/css/media/comment.hrx b/spec/css/media/comment.hrx new file mode 100644 index 0000000000..655ed828af --- /dev/null +++ b/spec/css/media/comment.hrx @@ -0,0 +1,27 @@ +<===> before_query/loud/input.scss +@media /**/ screen {} + +<===> before_query/loud/output.css + +<===> +================================================================================ +<===> before_query/silent/input.scss +@media // + screen {} + +<===> before_query/silent/output.css + +<===> +================================================================================ +<===> after_query/loud/input.scss +@media screen /**/ {} + +<===> after_query/loud/output.css + +<===> +================================================================================ +<===> after_query/silent/input.scss +@media screen // + {} + +<===> after_query/silent/output.css diff --git a/spec/css/moz_document/comment.hrx b/spec/css/moz_document/comment.hrx new file mode 100644 index 0000000000..373b6dfa6b --- /dev/null +++ b/spec/css/moz_document/comment.hrx @@ -0,0 +1,71 @@ +<===> before_arg/loud/input.scss +@-moz-document /**/ url-prefix(a) {} + +<===> before_arg/loud/output.css +@-moz-document url-prefix(a) {} + +<===> before_arg/loud/warning +DEPRECATION WARNING on line 1, column 1 of input.scss: +@-moz-document is deprecated and support will be removed in Dart Sass 2.0.0. + +For details, see https://sass-lang.com/d/moz-document. + , +1 | @-moz-document /**/ url-prefix(a) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + +<===> +================================================================================ +<===> before_arg/silent/input.scss +@-moz-document // + url-prefix(a) {} + +<===> before_arg/silent/output.css +@-moz-document url-prefix(a) {} + +<===> before_arg/silent/warning +DEPRECATION WARNING on line 1, column 1 of input.scss: +@-moz-document is deprecated and support will be removed in Dart Sass 2.0.0. + +For details, see https://sass-lang.com/d/moz-document. + , +1 | / @-moz-document // +2 | \ url-prefix(a) {} + ' + +<===> +================================================================================ +<===> after_arg/loud/input.scss +@-moz-document url-prefix(a) /**/ {} + +<===> after_arg/loud/output.css +@-moz-document url-prefix(a) {} + +<===> after_arg/loud/warning +DEPRECATION WARNING on line 1, column 1 of input.scss: +@-moz-document is deprecated and support will be removed in Dart Sass 2.0.0. + +For details, see https://sass-lang.com/d/moz-document. + , +1 | @-moz-document url-prefix(a) /**/ {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + +<===> +================================================================================ +<===> after_arg/silent/input.scss +@-moz-document url-prefix(a) // + {} + +<===> after_arg/silent/output.css +@-moz-document url-prefix(a) {} + +<===> after_arg/silent/warning +DEPRECATION WARNING on line 1, column 1 of input.scss: +@-moz-document is deprecated and support will be removed in Dart Sass 2.0.0. + +For details, see https://sass-lang.com/d/moz-document. + , +1 | / @-moz-document url-prefix(a) // +2 | \ {} + ' diff --git a/spec/css/propset.hrx b/spec/css/propset.hrx index bba68c3133..ad6b30661a 100644 --- a/spec/css/propset.hrx +++ b/spec/css/propset.hrx @@ -48,6 +48,51 @@ a { b-c: --d; } +<===> +================================================================================ +<===> comment/before_block/loud/input.scss +a {b: /**/ {c: d}} + +<===> comment/before_block/loud/output.css +a { + b-c: d; +} + +<===> +================================================================================ +<===> comment/before_block/silent/input.scss +a { + b: // + {c: d} +} + +<===> comment/before_block/silent/output.css +a { + b-c: d; +} + +<===> +================================================================================ +<===> comment/after_block/loud/input.scss +a {b: {c: d} /**/} + +<===> comment/after_block/loud/output.css +a { + b-c: d; /**/ +} + +<===> +================================================================================ +<===> comment/after_block/silent/input.scss +a { + b: {c: d} // +} + +<===> comment/after_block/silent/output.css +a { + b-c: d; +} + <===> ================================================================================ <===> error/value_after_propset/input.scss diff --git a/spec/css/style_rule.hrx b/spec/css/style_rule.hrx new file mode 100644 index 0000000000..fc8ed68aea --- /dev/null +++ b/spec/css/style_rule.hrx @@ -0,0 +1,75 @@ +<===> comment/after_selector/loud/input.scss +a /**/ {} + +<===> comment/after_selector/loud/output.css + +<===> +================================================================================ +<===> comment/after_selector/silent/input.scss +a // + {} + +<===> comment/after_selector/silent/output.css + +<===> +================================================================================ +<===> declaration/comment/before_colon/loud/input.scss +a {b /**/ : c} + +<===> declaration/comment/before_colon/loud/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> declaration/comment/before_colon/silent/input.scss +a {b // + : c} + +<===> declaration/comment/before_colon/silent/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> declaration/comment/after_colon/loud/input.scss +a {b: /**/ c} + +<===> declaration/comment/after_colon/loud/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> declaration/comment/after_colon/silent/input.scss +a {b: // + c} + +<===> declaration/comment/after_colon/silent/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> declaration/comment/after_value/loud/input.scss +a {b: c /**/} + +<===> declaration/comment/after_value/loud/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> declaration/comment/after_value/silent/input.scss +a {b: c // + } + +<===> declaration/comment/after_value/silent/output.css +a { + b: c; +} diff --git a/spec/css/supports/comment.hrx b/spec/css/supports/comment.hrx new file mode 100644 index 0000000000..74a6bf5b61 --- /dev/null +++ b/spec/css/supports/comment.hrx @@ -0,0 +1,27 @@ +<===> before_query/loud/input.scss +@supports /**/ (a: b) {} + +<===> before_query/loud/output.css + +<===> +================================================================================ +<===> before_query/silent/input.scss +@supports // + (a: b) {} + +<===> before_query/silent/output.css + +<===> +================================================================================ +<===> after_query/loud/input.scss +@supports (a: b) /**/ {} + +<===> after_query/loud/output.css + +<===> +================================================================================ +<===> after_query/silent/input.scss +@supports (a: b) // + {} + +<===> after_query/silent/output.css diff --git a/spec/css/unknown_directive/comment.hrx b/spec/css/unknown_directive/comment.hrx new file mode 100644 index 0000000000..c47a0ee37b --- /dev/null +++ b/spec/css/unknown_directive/comment.hrx @@ -0,0 +1,113 @@ +<===> no_children/before_value/loud/input.scss +@a /**/ b + +<===> no_children/before_value/loud/output.css +@a b; + +<===> +================================================================================ +<===> no_children/before_value/silent/input.scss +@a // + b + +<===> no_children/before_value/silent/output.css +@a b; + +<===> +================================================================================ +<===> no_children/after_value/loud/options.yml +:todo: + - sass/dart-sass#2263 + +<===> no_children/after_value/loud/input.scss +@a b /**/ + +<===> no_children/after_value/loud/output.css +@a b; + +<===> +================================================================================ +<===> no_children/after_value/silent/options.yml +:todo: + - sass/dart-sass#2263 + +<===> no_children/after_value/silent/input.scss +@a b // + +<===> no_children/after_value/silent/output.css +@a b; + +<===> +================================================================================ +<===> no_children/no_value/loud/input.scss +@a /**/ + +<===> no_children/no_value/loud/output.css +@a; + +<===> +================================================================================ +<===> no_children/no_value/silent/input.scss +@a // + +<===> no_children/no_value/silent/output.css +@a; + +<===> +================================================================================ +<===> children/before_value/loud/input.scss +@a /**/ b {} + +<===> children/before_value/loud/output.css +@a b {} + +<===> +================================================================================ +<===> children/before_value/silent/input.scss +@a // + b {} + +<===> children/before_value/silent/output.css +@a b {} + +<===> +================================================================================ +<===> children/after_value/loud/options.yml +:todo: + - sass/dart-sass#2263 + +<===> children/after_value/loud/input.scss +@a b /**/ {} + +<===> children/after_value/loud/output.css +@a b {}; + +<===> +================================================================================ +<===> children/after_value/silent/options.yml +:todo: + - sass/dart-sass#2263 + +<===> children/after_value/silent/input.scss +@a b // + {} + +<===> children/after_value/silent/output.css +@a b {}; + +<===> +================================================================================ +<===> children/no_value/loud/input.scss +@a /**/ {} + +<===> children/no_value/loud/output.css +@a {} + +<===> +================================================================================ +<===> children/no_value/silent/input.scss +@a // + {} + +<===> children/no_value/silent/output.css +@a {} diff --git a/spec/directives/at_root.hrx b/spec/directives/at_root.hrx index c1e29ee88a..ddef1f01ee 100644 --- a/spec/directives/at_root.hrx +++ b/spec/directives/at_root.hrx @@ -115,3 +115,108 @@ a { a b { c: d; } + +<===> +================================================================================ +<===> comment/before_query/loud/input.scss +@at-root /**/ (without: media) {} + +<===> comment/before_query/loud/output.css + +<===> +================================================================================ +<===> comment/before_query/silent/input.scss +@at-root // + (without: media) {} + +<===> comment/before_query/silent/output.css + +<===> +================================================================================ +<===> comment/after_open_paren/loud/input.scss +@at-root (/**/ without: media) {} + +<===> comment/after_open_paren/loud/output.css + +<===> +================================================================================ +<===> comment/after_open_paren/silent/input.scss +@at-root (// + without: media) {} + +<===> comment/after_open_paren/silent/output.css + +<===> +================================================================================ +<===> comment/before_colon/loud/input.scss +@at-root (without /**/ : media) {} + +<===> comment/before_colon/loud/output.css + +<===> +================================================================================ +<===> comment/before_colon/silent/input.scss +@at-root (without // + : media) {} + +<===> comment/before_colon/silent/output.css + +<===> +================================================================================ +<===> comment/after_colon/loud/input.scss +@at-root (without: /**/ media) {} + +<===> comment/after_colon/loud/output.css + +<===> +================================================================================ +<===> comment/after_colon/silent/input.scss +@at-root (without: // + media) {} + +<===> comment/after_colon/silent/output.css + +<===> +================================================================================ +<===> comment/before_close_paren/loud/input.scss +@at-root (without: media /**/) {} + +<===> comment/before_close_paren/loud/output.css + +<===> +================================================================================ +<===> comment/before_close_paren/silent/input.scss +@at-root (without: media // + ) {} + +<===> comment/before_close_paren/silent/output.css + +<===> +================================================================================ +<===> comment/after_query/loud/input.scss +@at-root (without: media) /**/ {} + +<===> comment/after_query/loud/output.css + +<===> +================================================================================ +<===> comment/after_query/silent/input.scss +@at-root (without: media) // + {} + +<===> comment/after_query/silent/output.css + +<===> +================================================================================ +<===> comment/no_query/loud/input.scss +@at-root /**/ {} + +<===> comment/no_query/loud/output.css + +<===> +================================================================================ +<===> comment/no_query/silent/input.scss +@at-root // + {} + +<===> comment/no_query/silent/output.css diff --git a/spec/directives/extend/comment.hrx b/spec/directives/extend/comment.hrx new file mode 100644 index 0000000000..24c6c67108 --- /dev/null +++ b/spec/directives/extend/comment.hrx @@ -0,0 +1,62 @@ +<===> before_arg/loud/input.scss +a {b: c} +d {@extend /**/ a} + +<===> before_arg/loud/output.css +a, d { + b: c; +} + +<===> +================================================================================ +<===> before_arg/silent/input.scss +a {b: c} +d { + @extend // + a +} + +<===> before_arg/silent/output.css +a, d { + b: c; +} + +<===> +================================================================================ +<===> after_arg/loud/input.scss +a {b: c} +d {@extend a /**/} + +<===> after_arg/loud/output.css +a, d { + b: c; +} + +<===> +================================================================================ +<===> after_arg/silent/input.scss +a {b: c} +d { + @extend a // +} + +<===> after_arg/silent/output.css +a, d { + b: c; +} + +<===> +================================================================================ +<===> after_optional/loud/input.scss +a {@extend b !optional /**/} + +<===> after_optional/loud/output.css + +<===> +================================================================================ +<===> after_optional/silent/input.scss +a { + @extend b !optional // +} + +<===> after_optional/silent/output.css diff --git a/spec/directives/for.hrx b/spec/directives/for.hrx index 2795e694ac..2c3f2229d9 100644 --- a/spec/directives/for.hrx +++ b/spec/directives/for.hrx @@ -232,6 +232,96 @@ a { b: 10mm; } +<===> +================================================================================ +<===> comment/before_var/loud/input.scss +@for /**/ $i from 1 through 10 {} + +<===> comment/before_var/loud/output.css + +<===> +================================================================================ +<===> comment/before_var/silent/input.scss +@for // + $i from 1 through 10 {} + +<===> comment/before_var/silent/output.css + +<===> +================================================================================ +<===> comment/before_from/loud/input.scss +@for $i /**/ from 1 through 10 {} + +<===> comment/before_from/loud/output.css + +<===> +================================================================================ +<===> comment/before_from/silent/input.scss +@for $i // + from 1 through 10 {} + +<===> comment/before_from/silent/output.css + +<===> +================================================================================ +<===> comment/after_from/loud/input.scss +@for $i from /**/ 1 through 10 {} + +<===> comment/after_from/loud/output.css + +<===> +================================================================================ +<===> comment/after_from/silent/input.scss +@for $i from // + 1 through 10 {} + +<===> comment/after_from/silent/output.css + +<===> +================================================================================ +<===> comment/before_through/loud/input.scss +@for $i from 1 /**/ through 10 {} + +<===> comment/before_through/loud/output.css + +<===> +================================================================================ +<===> comment/before_through/silent/input.scss +@for $i from 1 // + through 10 {} + +<===> comment/before_through/silent/output.css + +<===> +================================================================================ +<===> comment/after_through/loud/input.scss +@for $i from 1 through /**/ 10 {} + +<===> comment/after_through/loud/output.css + +<===> +================================================================================ +<===> comment/after_through/silent/input.scss +@for $i from 1 through // + 10 {} + +<===> comment/after_through/silent/output.css + +<===> +================================================================================ +<===> comment/before_block/loud/input.scss +@for $i from 1 through 10 /**/ {} + +<===> comment/before_block/loud/output.css + +<===> +================================================================================ +<===> comment/before_block/silent/input.scss +@for $i from 1 through 10 // + {} + +<===> comment/before_block/silent/output.css + <===> ================================================================================ <===> error/from_type/input.scss diff --git a/spec/directives/forward/comment.hrx b/spec/directives/forward/comment.hrx new file mode 100644 index 0000000000..7cac50d149 --- /dev/null +++ b/spec/directives/forward/comment.hrx @@ -0,0 +1,194 @@ +<===> before_url/loud/input.scss +@forward /**/ "other" + +<===> before_url/loud/other.scss + +<===> before_url/loud/output.css + +<===> +================================================================================ +<===> before_url/silent/input.scss +@forward // + "other" + +<===> before_url/silent/other.scss + +<===> before_url/silent/output.css + +<===> +================================================================================ +<===> after_url/loud/input.scss +@forward "other" /**/ + +<===> after_url/loud/other.scss + +<===> after_url/loud/output.css + +<===> +================================================================================ +<===> after_url/silent/input.scss +@forward "other" // + +<===> after_url/silent/other.scss + +<===> after_url/silent/output.css + +<===> +================================================================================ +<===> before_keyword/loud/input.scss +@forward "other" /**/ as a-* + +<===> before_keyword/loud/other.scss + +<===> before_keyword/loud/output.css + +<===> +================================================================================ +<===> before_keyword/silent/input.scss +@forward "other" // + as a-* + +<===> before_keyword/silent/other.scss + +<===> before_keyword/silent/output.css + +<===> +================================================================================ +<===> after_keyword/loud/input.scss +@forward "other" as /**/ a-* + +<===> after_keyword/loud/other.scss + +<===> after_keyword/loud/output.css + +<===> +================================================================================ +<===> after_keyword/silent/input.scss +@forward "other" as // + a-* + +<===> after_keyword/silent/other.scss + +<===> after_keyword/silent/output.css + +<===> +================================================================================ +<===> after_modifier/loud/input.scss +@forward "other" as a-* /**/ + +<===> after_modifier/loud/other.scss + +<===> after_modifier/loud/output.css + +<===> +================================================================================ +<===> after_modifier/silent/input.scss +@forward "other" as a-* // + +<===> after_modifier/silent/other.scss + +<===> after_modifier/silent/output.css + +<===> +================================================================================ +<===> after_open_paren/loud/input.scss +@forward "other" with (/**/ $a: b) + +<===> after_open_paren/loud/other.scss +$a: 1 !default + +<===> after_open_paren/loud/output.css + +<===> +================================================================================ +<===> after_paren/silent/input.scss +@forward "other" with (// + $a: b) + +<===> after_paren/silent/other.scss +$a: 1 !default + +<===> after_paren/silent/output.css + +<===> +================================================================================ +<===> before_colon/loud/input.scss +@forward "other" with ($a /**/ : b) + +<===> before_colon/loud/other.scss +$a: 1 !default + +<===> before_colon/loud/output.css + +<===> +================================================================================ +<===> before_colon/silent/input.scss +@forward "other" with ($a // + : b) + +<===> before_colon/silent/other.scss +$a: 1 !default + +<===> before_colon/silent/output.css + +<===> +================================================================================ +<===> after_colon/loud/input.scss +@forward "other" with ($a: /**/ b) + +<===> after_colon/loud/other.scss +$a: 1 !default + +<===> after_colon/loud/output.css + +<===> +================================================================================ +<===> after_colon/silent/input.scss +@forward "other" with ($a: // + b) + +<===> after_colon/silent/other.scss +$a: 1 !default + +<===> after_colon/silent/output.css + +<===> +================================================================================ +<===> before_close_paren/loud/input.scss +@forward "other" with ($a: b /**/) + +<===> before_close_paren/loud/other.scss +$a: 1 !default + +<===> before_close_paren/loud/output.css + +<===> +================================================================================ +<===> before_close_paren/silent/input.scss +@forward "other" with ($a: b // + ) + +<===> before_close_paren/silent/other.scss +$a: 1 !default + +<===> before_close_paren/silent/output.css + +<===> +================================================================================ +<===> after_close_paren/loud/input.scss +@forward "other" with ($a: b) /**/ + +<===> after_close_paren/loud/other.scss +$a: 1 !default + +<===> after_close_paren/loud/output.css + +<===> +================================================================================ +<===> after_close_paren/silent/input.scss +@forward "other" with ($a: b) // + +<===> after_close_paren/silent/other.scss +$a: 1 !default + +<===> after_close_paren/silent/output.css diff --git a/spec/directives/function.hrx b/spec/directives/function.hrx index 7c8c993088..eeccfebae2 100644 --- a/spec/directives/function.hrx +++ b/spec/directives/function.hrx @@ -91,4 +91,65 @@ b { c: 1; } +<===> +================================================================================ +<===> comment/function/before_name/loud/input.scss +@function /**/ a() {} + +<===> comment/function/before_name/loud/output.css + +<===> +================================================================================ +<===> comment/function/before_name/silent/input.scss +@function // + a() {} + +<===> comment/function/before_name/silent/output.css + +<===> +================================================================================ +<===> comment/function/after_args/loud/input.scss +@function a() /**/ {} + +<===> comment/function/after_args/loud/output.css + +<===> +================================================================================ +<===> comment/function/after_args/silent/input.scss +@function a() // + {} + +<===> comment/function/after_args/silent/output.css + +<===> +================================================================================ +<===> comment/return/before_value/loud/input.scss +@function a() {@return /**/ b} + +<===> comment/return/before_value/loud/output.css + +<===> +================================================================================ +<===> comment/return/before_value/silent/input.scss +@function a() { + @return // + b +} + +<===> comment/return/before_value/silent/output.css + +<===> +================================================================================ +<===> comment/return/after_value/loud/input.scss +@function a() {@return b /**/} + +<===> comment/return/after_value/loud/output.css + +<===> +================================================================================ +<===> comment/return/after_value/silent/input.scss +@function a() { + @return b // +} +<===> comment/return/after_value/silent/output.css diff --git a/spec/directives/if/comment.hrx b/spec/directives/if/comment.hrx new file mode 100644 index 0000000000..1252255886 --- /dev/null +++ b/spec/directives/if/comment.hrx @@ -0,0 +1,95 @@ +<===> comment/if/before_condition/loud/input.scss +@if /**/ true {} + +<===> comment/if/before_condition/loud/output.css + +<===> +================================================================================ +<===> comment/if/before_condition/silent/input.scss +@if // + true {} + +<===> comment/if/before_condition/silent/output.css + +<===> +================================================================================ +<===> comment/if/after_condition/loud/input.scss +@if true /**/ {} + +<===> comment/if/after_condition/loud/output.css + +<===> +================================================================================ +<===> comment/if/after_condition/silent/input.scss +@if true // + {} + +<===> comment/if/after_condition/silent/output.css + +<===> +================================================================================ +<===> comment/else_if/before_if/loud/input.scss +@if true {} +@else /**/ if true {} + +<===> comment/else_if/before_if/loud/output.css + +<===> +================================================================================ +<===> comment/else_if/before_if/silent/input.scss +@if true {} +@else // + if true {} + +<===> comment/else_if/before_if/silent/output.css + +<===> +================================================================================ +<===> comment/else_if/before_condition/loud/input.scss +@if true {} +@else if /**/ true {} + +<===> comment/else_if/before_condition/loud/output.css + +<===> +================================================================================ +<===> comment/else_if/before_condition/silent/input.scss +@if true {} +@else if // + true {} + +<===> comment/else_if/before_condition/silent/output.css + +<===> +================================================================================ +<===> comment/else_if/after_condition/loud/input.scss +@if true {} +@else if true /**/ {} + +<===> comment/else_if/after_condition/loud/output.css + +<===> +================================================================================ +<===> comment/else_if/after_condition/silent/input.scss +@if true {} +@else if true // + {} + +<===> comment/else_if/after_condition/silent/output.css + +<===> +================================================================================ +<===> comment/else/before_block/loud/input.scss +@if true {} +@else /**/ {} + +<===> comment/else/before_block/loud/output.css + +<===> +================================================================================ +<===> comment/else/before_block/silent/input.scss +@if true {} +@else // + {} + +<===> comment/else/before_block/silent/output.css diff --git a/spec/directives/import/comment.hrx b/spec/directives/import/comment.hrx new file mode 100644 index 0000000000..12f05d1ba6 --- /dev/null +++ b/spec/directives/import/comment.hrx @@ -0,0 +1,68 @@ +<===> before_url/loud/input.scss +@import /**/ "a.css" + +<===> before_url/loud/output.css +@import "a.css"; + +<===> +================================================================================ +<===> before_url/silent/input.scss +@import // + "a.css" + +<===> before_url/silent/output.css +@import "a.css"; + +<===> +================================================================================ +<===> after_url/loud/input.scss +@import "a.css" /**/ + +<===> after_url/loud/output.css +@import "a.css"; + +<===> +================================================================================ +<===> after_url/silent/input.scss +@import "a.css" // + +<===> after_url/silent/output.css +@import "a.css"; + +<===> +================================================================================ +<===> before_comma/loud/input.scss +@import "a.css" /**/, "b.css" + +<===> before_comma/loud/output.css +@import "a.css"; +@import "b.css"; + +<===> +================================================================================ +<===> before_comma/silent/input.scss +@import "a.css" // + , "b.css" + +<===> before_comma/silent/output.css +@import "a.css"; +@import "b.css"; + +<===> +================================================================================ +<===> after_comma/loud/input.scss +@import "a.css", /**/ "b.css" + +<===> after_comma/loud/output.css +@import "a.css"; +@import "b.css"; + +<===> +================================================================================ +<===> after_comma/silent/input.scss +@import "a.css", // + "b.css" + +<===> after_comma/silent/output.css +@import "a.css"; +@import "b.css"; diff --git a/spec/directives/mixin.hrx b/spec/directives/mixin.hrx index 93e3568647..494dcb1852 100644 --- a/spec/directives/mixin.hrx +++ b/spec/directives/mixin.hrx @@ -49,3 +49,182 @@ For details, see https://sass-lang.com/d/css-function-mixin | ^^^ ' input.scss 2:13 root stylesheet + +<===> +================================================================================ +<===> comment/mixin/before_name/loud/input.scss +@mixin /**/ a {} + +<===> comment/mixin/before_name/loud/output.css + +<===> +================================================================================ +<===> comment/mixin/before_name/silent/input.scss +@mixin // + a {} + +<===> comment/mixin/before_name/silent/output.css + +<===> +================================================================================ +<===> comment/mixin/after_args/loud/input.scss +@mixin a() /**/ {} + +<===> comment/mixin/after_args/loud/output.css + +<===> +================================================================================ +<===> comment/mixin/after_args/silent/input.scss +@mixin a() // + {} + +<===> comment/mixin/after_args/silent/output.css + +<===> +================================================================================ +<===> comment/content/after_content/loud/input.scss +@mixin a {@content /**/} + +<===> comment/content/after_content/loud/output.css + +<===> +================================================================================ +<===> comment/content/after_content/silent/input.scss +@mixin a { + @content // +} + +<===> comment/content/after_content/silent/output.css + +<===> +================================================================================ +<===> comment/content/after_args/loud/input.scss +@mixin a {@content() /**/} + +<===> comment/content/after_args/loud/output.css + +<===> +================================================================================ +<===> comment/content/after_args/silent/input.scss +@mixin a { + @content() // +} + +<===> comment/content/after_args/silent/output.css + +<===> +================================================================================ +<===> comment/include/before_name/loud/input.scss +@mixin a {} +@include /**/ a + +<===> comment/include/before_name/loud/output.css + +<===> +================================================================================ +<===> comment/include/before_name/silent/input.scss +@mixin a {} +@include // + a + +<===> comment/include/before_name/silent/output.css + +<===> +================================================================================ +<===> comment/include/after_name/loud/input.scss +@mixin a {} +@include a /**/ + +<===> comment/include/after_name/loud/output.css + +<===> +================================================================================ +<===> comment/include/after_name/silent/input.scss +@mixin a {} +@include a // + +<===> comment/include/after_name/silent/output.css + +<===> +================================================================================ +<===> comment/include/after_args/loud/input.scss +@mixin a {} +@include a() /**/ + +<===> comment/include/after_args/loud/output.css + +<===> +================================================================================ +<===> comment/include/after_args/silent/input.scss +@mixin a {} +@include a() // + +<===> comment/include/after_args/silent/output.css + +<===> +================================================================================ +<===> comment/include/before_block/loud/input.scss +@mixin a {@content} +@include a() /**/ {} + +<===> comment/include/before_block/loud/output.css + +<===> +================================================================================ +<===> comment/include/before_block/silent/input.scss +@mixin a {@content} +@include a() // + {} + +<===> comment/include/before_block/silent/output.css + +<===> +================================================================================ +<===> comment/include/before_using/loud/input.scss +@mixin a {@content} +@include a() /**/ using () {} + +<===> comment/include/before_using/loud/output.css + +<===> +================================================================================ +<===> comment/include/before_using/silent/input.scss +@mixin a {@content} +@include a() // + using () {} + +<===> comment/include/before_using/silent/output.css + +<===> +================================================================================ +<===> comment/include/after_using/loud/input.scss +@mixin a {@content} +@include a() using /**/ () {} + +<===> comment/include/after_using/loud/output.css + +<===> +================================================================================ +<===> comment/include/after_using/silent/input.scss +@mixin a {@content} +@include a() using // + () {} + +<===> comment/include/after_using/silent/output.css + +<===> +================================================================================ +<===> comment/include/after_using_arglist/loud/input.scss +@mixin a {@content} +@include a() using () /**/ {} + +<===> comment/include/after_using_arglist/loud/output.css + +<===> +================================================================================ +<===> comment/include/after_using_arglist/silent/input.scss +@mixin a {@content} +@include a() using () // + {} + +<===> comment/include/after_using_arglist/silent/output.css diff --git a/spec/directives/use/comment.hrx b/spec/directives/use/comment.hrx new file mode 100644 index 0000000000..b8d0511ca9 --- /dev/null +++ b/spec/directives/use/comment.hrx @@ -0,0 +1,194 @@ +<===> before_url/loud/input.scss +@use /**/ "other" + +<===> before_url/loud/other.scss + +<===> before_url/loud/output.css + +<===> +================================================================================ +<===> before_url/silent/input.scss +@use // + "other" + +<===> before_url/silent/other.scss + +<===> before_url/silent/output.css + +<===> +================================================================================ +<===> after_url/loud/input.scss +@use "other" /**/ + +<===> after_url/loud/other.scss + +<===> after_url/loud/output.css + +<===> +================================================================================ +<===> after_url/silent/input.scss +@use "other" // + +<===> after_url/silent/other.scss + +<===> after_url/silent/output.css + +<===> +================================================================================ +<===> before_keyword/loud/input.scss +@use "other" /**/ as a + +<===> before_keyword/loud/other.scss + +<===> before_keyword/loud/output.css + +<===> +================================================================================ +<===> before_keyword/silent/input.scss +@use "other" // + as a + +<===> before_keyword/silent/other.scss + +<===> before_keyword/silent/output.css + +<===> +================================================================================ +<===> after_keyword/loud/input.scss +@use "other" as /**/ a + +<===> after_keyword/loud/other.scss + +<===> after_keyword/loud/output.css + +<===> +================================================================================ +<===> after_keyword/silent/input.scss +@use "other" as // + a + +<===> after_keyword/silent/other.scss + +<===> after_keyword/silent/output.css + +<===> +================================================================================ +<===> after_modifier/loud/input.scss +@use "other" as a /**/ + +<===> after_modifier/loud/other.scss + +<===> after_modifier/loud/output.css + +<===> +================================================================================ +<===> after_modifier/silent/input.scss +@use "other" as a // + +<===> after_modifier/silent/other.scss + +<===> after_modifier/silent/output.css + +<===> +================================================================================ +<===> after_open_paren/loud/input.scss +@use "other" with (/**/ $a: b) + +<===> after_open_paren/loud/other.scss +$a: 1 !default + +<===> after_open_paren/loud/output.css + +<===> +================================================================================ +<===> after_paren/silent/input.scss +@use "other" with (// + $a: b) + +<===> after_paren/silent/other.scss +$a: 1 !default + +<===> after_paren/silent/output.css + +<===> +================================================================================ +<===> before_colon/loud/input.scss +@use "other" with ($a /**/ : b) + +<===> before_colon/loud/other.scss +$a: 1 !default + +<===> before_colon/loud/output.css + +<===> +================================================================================ +<===> before_colon/silent/input.scss +@use "other" with ($a // + : b) + +<===> before_colon/silent/other.scss +$a: 1 !default + +<===> before_colon/silent/output.css + +<===> +================================================================================ +<===> after_colon/loud/input.scss +@use "other" with ($a: /**/ b) + +<===> after_colon/loud/other.scss +$a: 1 !default + +<===> after_colon/loud/output.css + +<===> +================================================================================ +<===> after_colon/silent/input.scss +@use "other" with ($a: // + b) + +<===> after_colon/silent/other.scss +$a: 1 !default + +<===> after_colon/silent/output.css + +<===> +================================================================================ +<===> before_close_paren/loud/input.scss +@use "other" with ($a: b /**/) + +<===> before_close_paren/loud/other.scss +$a: 1 !default + +<===> before_close_paren/loud/output.css + +<===> +================================================================================ +<===> before_close_paren/silent/input.scss +@use "other" with ($a: b // + ) + +<===> before_close_paren/silent/other.scss +$a: 1 !default + +<===> before_close_paren/silent/output.css + +<===> +================================================================================ +<===> after_close_paren/loud/input.scss +@use "other" with ($a: b) /**/ + +<===> after_close_paren/loud/other.scss +$a: 1 !default + +<===> after_close_paren/loud/output.css + +<===> +================================================================================ +<===> after_close_paren/silent/input.scss +@use "other" with ($a: b) // + +<===> after_close_paren/silent/other.scss +$a: 1 !default + +<===> after_close_paren/silent/output.css diff --git a/spec/directives/warn.hrx b/spec/directives/warn.hrx index 53358fa42a..6042e9bfd5 100644 --- a/spec/directives/warn.hrx +++ b/spec/directives/warn.hrx @@ -128,3 +128,48 @@ WARNING: From function: testing input.scss 2:3 issues-warning() input.scss 7:11 calls-function-that-warns() input.scss 11:3 root stylesheet + +<===> +================================================================================ +<===> comment/before_expression/loud/input.scss +@warn /**/ a + +<===> comment/before_expression/loud/output.css + +<===> comment/before_expression/loud/warning +WARNING: a + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> comment/before_expression/silent/input.scss +@warn // + a + +<===> comment/before_expression/silent/output.css + +<===> comment/before_expression/silent/warning +WARNING: a + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> comment/after_expression/loud/input.scss +@warn a /**/ + +<===> comment/after_expression/loud/output.css + +<===> comment/after_expression/loud/warning +WARNING: a + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> comment/after_expression/silent/input.scss +@warn a // + +<===> comment/after_expression/silent/output.css + +<===> comment/after_expression/silent/warning +WARNING: a + input.scss 1:1 root stylesheet diff --git a/spec/variables.hrx b/spec/variables.hrx index 3195ec9d5f..5954b8dc2a 100644 --- a/spec/variables.hrx +++ b/spec/variables.hrx @@ -59,3 +59,47 @@ This will be an error in Dart Sass 2.0.0. 3 | $a: d !global !global; | ^^^^^^^ ' + +<===> +================================================================================ +<===> comment/before_colon/loud/input.scss +$a /**/: b + +<===> comment/before_colon/loud/output.css + +<===> +================================================================================ +<===> comment/before_colon/silent/input.scss +$a // + : b + +<===> comment/before_colon/silent/output.css + +<===> +================================================================================ +<===> comment/after_colon/loud/input.scss +$a: /**/ b + +<===> comment/after_colon/loud/output.css + +<===> +================================================================================ +<===> comment/after_colon/silent/input.scss +$a: // + b + +<===> comment/after_colon/silent/output.css + +<===> +================================================================================ +<===> comment/after_value/loud/input.scss +$a: b /**/ + +<===> comment/after_value/loud/output.css + +<===> +================================================================================ +<===> comment/after_value/silent/input.scss +$a: b // + +<===> comment/after_value/silent/output.css