Skip to content

Commit 92f8093

Browse files
committed
fix: Global states can be combined with the :scope selector.
1 parent 4c156d1 commit 92f8093

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/@css-blocks/core/src/BlockParser/block-intermediates.ts

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ export function isExternalBlock(object: NodeAndType): boolean {
9999
* @param object The NodeAndType's descriptor object.
100100
*/
101101
export function isRootLevelObject(object: NodeAndType): object is RootAttributeNode | RootClassNode {
102+
// Exclude foreign blocks from being considered root level objects.
103+
if (object.blockType === BlockType.attribute && object.blockName) return false;
102104
return object.blockType === BlockType.root || object.blockType === BlockType.attribute;
103105
}
104106

packages/@css-blocks/core/test/global-states-test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export class BlockInheritance extends BEMProcessor {
2020

2121
let filename = "widget.block.css";
2222
let inputCSS = `@block app from "./app.block.css";
23+
app[state|is-loading] :scope {
24+
border: none;
25+
}
2326
app[state|is-loading] .b {
2427
border: none;
2528
}`;
@@ -28,6 +31,7 @@ export class BlockInheritance extends BEMProcessor {
2831
imports.assertImported("app.block.css");
2932
assert.deepEqual(
3033
result.css.toString(),
34+
".app--is-loading .widget { border: none; }\n" +
3135
".app--is-loading .widget__b { border: none; }\n",
3236
);
3337
});

0 commit comments

Comments
 (0)