From 197fd94c0097c569bb3a6f9eaf662eaa1a08760d Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 15 May 2024 15:31:18 -0700 Subject: [PATCH] Add tests for underscores where hyphens aren't allowed --- spec/directives/function.hrx | 62 ++++++++++++++++++++++++++++++++++++ spec/directives/mixin.hrx | 33 +++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/spec/directives/function.hrx b/spec/directives/function.hrx index 472d9f973..7c8c99308 100644 --- a/spec/directives/function.hrx +++ b/spec/directives/function.hrx @@ -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; +} + + diff --git a/spec/directives/mixin.hrx b/spec/directives/mixin.hrx index 9f65b2262..93e356864 100644 --- a/spec/directives/mixin.hrx +++ b/spec/directives/mixin.hrx @@ -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