diff --git a/packages/core/src/helpers/rule.ts b/packages/core/src/helpers/rule.ts index 409162eba..f04c36d2b 100644 --- a/packages/core/src/helpers/rule.ts +++ b/packages/core/src/helpers/rule.ts @@ -106,13 +106,14 @@ export function createSubsetAst containsPrefix(node)); if (matchesSelectors.length) { - isNestedInMixin = true; + atruleHasMixin = true; scopeSelector = stringifySelector( matchesSelectors.map((selectorNode) => { if (!isRoot) { @@ -133,7 +134,7 @@ export function createSubsetAst { shouldReportNoDiagnostics(meta); }); + it('should collect only st-scope nested rules', () => { + const { sheets } = testStylableCore({ + '/mix.st.css': ` + .before { color: RED; } + @st-scope .mix { + .inside { color: green; } + } + .after { color: RED; } + `, + '/entry.st.css': ` + @st-import [mix] from './mix.st.css'; + + .into {-st-mixin: mix;} + `, + }); + + const { meta } = sheets['/entry.st.css']; + + shouldReportNoDiagnostics(meta); + + expect(deindent(meta.targetAst!.toString())).to.eql( + deindent(` + .entry__into {} + .entry__into .mix__inside { color: green; } + `) + ); + }); }); describe(`higher-level feature integrations`, () => { // ToDo: move to their higher level feature spec when created