Skip to content

Commit

Permalink
Add tests for underscores where hyphens aren't allowed (#1994)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed May 16, 2024
1 parent db58e87 commit dd934e0
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
62 changes: 62 additions & 0 deletions spec/directives/function.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,65 @@ For details, see https://sass-lang.com/d/css-function-mixin
1 | @function --a() {@return 1}
| ^^^
'

<===>
================================================================================
<===> double_underscore_name/input.scss
@function __a() {@return 1}
b {c: __a()}

<===> double_underscore_name/output.css
b {
c: 1;
}

<===>
================================================================================
<===> custom_ident_call/input.scss
@function __a() {@return 1}
b {c: --a()}

<===> custom_ident_call/output.css
b {
c: 1;
}

<===> custom_ident_call/warning
DEPRECATION WARNING: Sass @function names beginning with -- are deprecated for forward-compatibility with plain CSS functions.

For details, see https://sass-lang.com/d/css-function-mixin

,
2 | b {c: --a()}
| ^^^
'
input.scss 2:7 root stylesheet

<===>
================================================================================
<===> vendor_like_underscore/README.md
Function names like `-moz-calc()` aren't allowed, but they are with underscores.

<===>
================================================================================
<===> vendor_like_underscore/start/input.scss
@function _moz-calc() {@return 1}
b {c: _moz-calc()}

<===> vendor_like_underscore/start/output.css
b {
c: 1;
}

<===>
================================================================================
<===> vendor_like_underscore/middle/input.scss
@function -moz_calc() {@return 1}
b {c: -moz_calc()}

<===> vendor_like_underscore/middle/output.css
b {
c: 1;
}


33 changes: 33 additions & 0 deletions spec/directives/mixin.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,36 @@ For details, see https://sass-lang.com/d/css-function-mixin
1 | @mixin --a {b: c}
| ^^^
'

<===>
================================================================================
<===> double_underscore_name/input.scss
@mixin __a() {b: c}
d {@include __a}

<===> double_underscore_name/output.css
d {
b: c;
}

<===>
================================================================================
<===> custom_ident_include/input.scss
@mixin __a() {b: c}
d {@include --a}

<===> custom_ident_include/output.css
d {
b: c;
}

<===> custom_ident_include/warning
DEPRECATION WARNING: Sass @mixin names beginning with -- are deprecated for forward-compatibility with plain CSS mixins.

For details, see https://sass-lang.com/d/css-function-mixin

,
2 | d {@include --a}
| ^^^
'
input.scss 2:13 root stylesheet

0 comments on commit dd934e0

Please sign in to comment.