From 33c316bd0917122b34dea65ae480d49e2effd1f6 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 26 Apr 2024 16:44:31 -0700 Subject: [PATCH] Add deprecation tests for custom-ident functions and mixins --- js-api-spec/deprecations.test.ts | 1 + spec/directives/function.hrx | 32 ++++++++++++++++++++++++++++ spec/directives/function/escaped.hrx | 11 ---------- spec/directives/mixin.hrx | 18 ++++++++++++++++ 4 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 spec/directives/function.hrx delete mode 100644 spec/directives/function/escaped.hrx create mode 100644 spec/directives/mixin.hrx diff --git a/js-api-spec/deprecations.test.ts b/js-api-spec/deprecations.test.ts index 0ed89478a4..49d9819791 100644 --- a/js-api-spec/deprecations.test.ts +++ b/js-api-spec/deprecations.test.ts @@ -38,6 +38,7 @@ const activeDeprecations: {[key in keyof Deprecations]?: string} = { 'null-alpha': '1.62.3', 'abs-percent': '1.65.0', 'fs-importer-cwd': '1.73.0', + 'css-function-mixin': '1.76.0', }; /** diff --git a/spec/directives/function.hrx b/spec/directives/function.hrx new file mode 100644 index 0000000000..472d9f9736 --- /dev/null +++ b/spec/directives/function.hrx @@ -0,0 +1,32 @@ +<===> escaped/input.scss +// Function names can be defined and referred to using escapes, which are +// normalized. +@function f\6Fo-bar() {@return 1} + +a {b: foo-b\61r()} + +<===> escaped/output.css +a { + b: 1; +} + +<===> +================================================================================ +<===> custom_ident_name/input.scss +@function --a() {@return 1} +b {c: --a()} + +<===> custom_ident_name/output.css +b { + c: 1; +} + +<===> custom_ident_name/warning +DEPRECATION WARNING on line 1, column 11 of input.scss: +Sass @function names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. + +For details, see https://sass-lang.com/d/css-function-mixin + , +1 | @function --a() {@return 1} + | ^^^ + ' diff --git a/spec/directives/function/escaped.hrx b/spec/directives/function/escaped.hrx deleted file mode 100644 index a43f229f71..0000000000 --- a/spec/directives/function/escaped.hrx +++ /dev/null @@ -1,11 +0,0 @@ -<===> input.scss -// Function names can be defined and referred to using escapes, which are -// normalized. -@function f\6Fo-bar() {@return 1} - -a {b: foo-b\61r()} - -<===> output.css -a { - b: 1; -} diff --git a/spec/directives/mixin.hrx b/spec/directives/mixin.hrx new file mode 100644 index 0000000000..9f65b2262a --- /dev/null +++ b/spec/directives/mixin.hrx @@ -0,0 +1,18 @@ +<===> custom_ident_name/input.scss +@mixin --a {b: c} +d {@include --a} + +<===> custom_ident_name/output.css +d { + b: c; +} + +<===> custom_ident_name/warning +DEPRECATION WARNING on line 1, column 8 of input.scss: +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 + , +1 | @mixin --a {b: c} + | ^^^ + '