import { describe, it, expect } from "vitest"; import { lintHyperframeHtml } from "../hyperframeLinter.js"; describe("caption rules", () => { it("warns when caption exit has no hard kill tl.set", async () => { const html = `
`; const result = await lintHyperframeHtml(html); const finding = result.findings.find((f) => f.code === "caption_exit_missing_hard_kill"); expect(finding).toBeDefined(); expect(finding?.severity).toBe("error"); }); it("does not warn when caption exit has hard kill tl.set", async () => { const html = `
`; const result = await lintHyperframeHtml(html); const finding = result.findings.find((f) => f.code === "caption_exit_missing_hard_kill"); expect(finding).toBeUndefined(); }); it("does not warn for generic GSAP opacity exits in non-caption loops", async () => { const html = `
`; const result = await lintHyperframeHtml(html); const finding = result.findings.find((f) => f.code === "caption_exit_missing_hard_kill"); expect(finding).toBeUndefined(); }); it("does not warn on a content frame that only mentions karaoke in a comment", async () => { const html = ``; const result = await lintHyperframeHtml(html, { isSubComposition: true }); const finding = result.findings.find((f) => f.code === "caption_exit_missing_hard_kill"); expect(finding).toBeUndefined(); }); it("warns when caption group has nowrap without max-width", async () => { const html = `
`; const result = await lintHyperframeHtml(html); const finding = result.findings.find((f) => f.code === "caption_text_overflow_risk"); expect(finding).toBeDefined(); expect(finding?.severity).toBe("warning"); }); it("does not warn when caption group has nowrap with max-width", async () => { const html = `
`; const result = await lintHyperframeHtml(html); const finding = result.findings.find( (f) => f.code === "caption_text_overflow_risk" && f.severity === "warning", ); expect(finding).toBeUndefined(); }); it("warns when caption container uses position: relative", async () => { const html = `
`; const result = await lintHyperframeHtml(html); const finding = result.findings.find((f) => f.code === "caption_container_relative_position"); expect(finding).toBeDefined(); expect(finding?.severity).toBe("error"); }); });