From 2bc9b348121b99da1aaf16f02f6299801ecc4a89 Mon Sep 17 00:00:00 2001 From: Ido Rosenthal Date: Thu, 28 Sep 2023 18:44:52 +0300 Subject: [PATCH] feat!: no transform or global for multi selector --- packages/core/src/features/css-class.ts | 1 + packages/core/test/features/css-class.spec.ts | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/src/features/css-class.ts b/packages/core/src/features/css-class.ts index acff7f24e..ae9fcabf2 100644 --- a/packages/core/src/features/css-class.ts +++ b/packages/core/src/features/css-class.ts @@ -668,6 +668,7 @@ function parseStGlobal( context.diagnostics.report(diagnostics.UNSUPPORTED_MULTI_SELECTORS_ST_GLOBAL(), { node: decl, }); + return; } else { for (const node of selector[0].nodes) { if (node.type === 'combinator') { diff --git a/packages/core/test/features/css-class.spec.ts b/packages/core/test/features/css-class.spec.ts index 43b02660c..ed091870c 100644 --- a/packages/core/test/features/css-class.spec.ts +++ b/packages/core/test/features/css-class.spec.ts @@ -198,7 +198,7 @@ describe(`features/css-class`, () => { -st-global: ""; } - /* @rule(empty) .y */ + /* @rule(multi) .entry__b */ .b { /* @analyze-error(multi) ${classDiagnostics.UNSUPPORTED_MULTI_SELECTORS_ST_GLOBAL()} */ -st-global: ".y , .z"; @@ -214,13 +214,11 @@ describe(`features/css-class`, () => { const { meta, exports } = sheets['/entry.st.css']; // meta.globals - expect(meta.globals).to.eql({ - y: true, - }); + expect(meta.globals).to.eql({}); // JS exports expect(exports.classes.a, `a (empty) JS export`).to.eql(`entry__a`); - expect(exports.classes.b, `b (multi) JS export`).to.eql(`y`); + expect(exports.classes.b, `b (multi) JS export`).to.eql(`entry__b`); expect(exports.classes.c, `c (complex) JS export`).to.eql(`entry__c`); }); it(`should escape`, () => {