diff --git a/packages/core/src/compiler/inlineSubCompositions.test.ts b/packages/core/src/compiler/inlineSubCompositions.test.ts index bf52cffc4e..c20a3c750e 100644 --- a/packages/core/src/compiler/inlineSubCompositions.test.ts +++ b/packages/core/src/compiler/inlineSubCompositions.test.ts @@ -175,6 +175,52 @@ describe("inlineSubCompositions – #ID selector scoping divergence", () => { expect(scopedCss).toContain('[data-hf-authored-id="intro"]'); }); + it("with flattenInnerRoot: restores data-composition-id on the wrapper for an anonymous host", () => { + // Regression test: a host mounted via data-composition-src with no + // data-composition-id of its own (an "anonymous" host). The composition + // styles its own root box via the bare composition-id selector and a + // script self-references it too — both need something in the render DOM + // to actually carry that id once flattenInnerRoot strips it from the + // wrapper by default. + const { document } = parseHTML(` +
+