Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
test: add coverage for slideshow_unresolved_ref and subcomposition_root_styled_by_class (#5399)
Yash Rastogi33cffbf06b73
diff --git a/packages/lint/src/rules/composition.test.ts b/packages/lint/src/rules/composition.test.tsindex a2c4b33d13..604b556081 100644--- a/packages/lint/src/rules/composition.test.ts+++ b/packages/lint/src/rules/composition.test.ts@@ -2622,4 +2622,54 @@ ${body}expect(result.findings.filter((f) => f.code === "negative_z_index")).toHaveLength(2);});});++ describe("subcomposition_root_styled_by_class", () => {+ it("flags when the root class is used as a CSS selector in a sub-composition", async () => {+ const html = `<!doctype html><html><body>+ <style>+ .my-root { background: red; }+ </style>+ <div data-composition-id="main" class="my-root" data-start="0" data-duration="5"></div>+ </body></html>`;++ const result = await lintHyperframeHtml(html, { isSubComposition: true });+ expect(result.findings).toContainEqual(+ expect.objectContaining({+ code: "subcomposition_root_styled_by_class",+ severity: "error",+ }),+ );+ });++ it("passes when styling via #root and descendant selectors", async () => {+ const html = `<!doctype html><html><body>+ <style>+ #root { background: red; }+ .child { color: blue; }+ </style>+ <div data-composition-id="main" id="root" class="my-root" data-start="0" data-duration="5">+ <div class="child"></div>+ </div>+ </body></html>`;++ const result = await lintHyperframeHtml(html, { isSubComposition: true });+ expect(result.findings.some((f) => f.code === "subcomposition_root_styled_by_class")).toBe(+ false,+ );+ });++ it("passes if it is not a sub-composition", async () => {+ const html = `<!doctype html><html><body>+ <style>+ .my-root { background: red; }+ </style>+ <div data-composition-id="main" class="my-root" data-start="0" data-duration="5"></div>+ </body></html>`;++ const result = await lintHyperframeHtml(html, { isSubComposition: false });+ expect(result.findings.some((f) => f.code === "subcomposition_root_styled_by_class")).toBe(+ false,+ );+ });+ });});diff --git a/packages/lint/src/rules/slideshow.test.ts b/packages/lint/src/rules/slideshow.test.tsindex 4c801e66bf..4e768db96d 100644--- a/packages/lint/src/rules/slideshow.test.ts+++ b/packages/lint/src/rules/slideshow.test.ts@@ -86,4 +86,27 @@ describe("slideshow lint rule", () => {expect(findings.length).toBeGreaterThan(0);expect(findings[0]!.message).toContain("no-such-seq");});++ it("flags slideshow_unresolved_ref when a sceneId in the manifest is missing from the document", async () => {+ const html = `<div data-composition-id="c" data-width="1920" data-height="1080">+ <div data-composition-id="scene-a" data-start="0" data-duration="5"></div>+ <script type="application/hyperframes-slideshow+json">{"slides":[{"sceneId":"missing-scene"}]}</script>+ </div>`;+ const findings = await findSlideshow(html);+ expect(findings).toContainEqual(+ expect.objectContaining({+ code: "slideshow_unresolved_ref",+ severity: "error",+ }),+ );+ });++ it("passes slideshow_unresolved_ref when all manifest sceneIds exist as data-composition-id", async () => {+ const html = `<div data-composition-id="c" data-width="1920" data-height="1080">+ <div data-composition-id="scene-1" data-start="0" data-duration="5"></div>+ <script type="application/hyperframes-slideshow+json">{"slides":[{"sceneId":"scene-1"}]}</script>+ </div>`;+ const findings = await findSlideshow(html);+ expect(findings.some((f) => f.code === "slideshow_unresolved_ref")).toBe(false);+ });});