diff --git a/packages/cli/src/utils/lintProject.test.ts b/packages/cli/src/utils/lintProject.test.ts index d3c0204cd1..41b59fb3a0 100644 --- a/packages/cli/src/utils/lintProject.test.ts +++ b/packages/cli/src/utils/lintProject.test.ts @@ -142,17 +142,19 @@ describe("lintProject", () => { }); writeFileSync( join(project, "compositions", "scene.css"), - '[data-composition-id="scene"] .title { opacity: 0; }', + '[data-composition-id="no-such-comp"] .title { opacity: 0; }', ); const { results } = await lintProject(project); const subResult = results.find((result) => result.file === "compositions/scene.html"); + // The linked stylesheet scopes CSS to a composition id that has no wrapper + // here, so this finding can only come from the linked file being read. const finding = subResult?.result.findings.find( - (item) => item.code === "composition_self_attribute_selector", + (item) => item.code === "scoped_css_missing_wrapper", ); expect(finding).toBeDefined(); - expect(finding?.selector).toBe('[data-composition-id="scene"] .title'); + expect(finding?.selector).toBe('[data-composition-id="no-such-comp"]'); }); it("lints percent-encoded linked CSS filenames that exist decoded on disk", async () => { @@ -165,17 +167,19 @@ describe("lintProject", () => { }); writeFileSync( join(project, "compositions", decodeURIComponent(encodedFilename)), - '[data-composition-id="scene"] .title { opacity: 0; }', + '[data-composition-id="no-such-comp"] .title { opacity: 0; }', ); const { results } = await lintProject(project); const subResult = results.find((result) => result.file === "compositions/scene.html"); + // The linked stylesheet scopes CSS to a composition id that has no wrapper + // here, so this finding can only come from the linked file being read. const finding = subResult?.result.findings.find( - (item) => item.code === "composition_self_attribute_selector", + (item) => item.code === "scoped_css_missing_wrapper", ); expect(finding).toBeDefined(); - expect(finding?.selector).toBe('[data-composition-id="scene"] .title'); + expect(finding?.selector).toBe('[data-composition-id="no-such-comp"]'); }); it("aggregates errors across index.html and sub-compositions", async () => { diff --git a/packages/lint/src/project.test.ts b/packages/lint/src/project.test.ts index 67aa45b126..440974e09c 100644 --- a/packages/lint/src/project.test.ts +++ b/packages/lint/src/project.test.ts @@ -245,22 +245,31 @@ describe("template shell style sources", () => {
- + - +