import { describe, it, expect } from "vitest";
import { lintHyperframeHtml } from "../hyperframeLinter.js";
function compositionWithHead(headContent: string): string {
return `
${headContent}
`;
}
function compositionWithHeadBoundary(boundaryContent: string): string {
return `
${boundaryContent}
`;
}
function compositionWithBodyPrefix(prefixContent: string, rootContent = ""): string {
return `
${prefixContent}
${rootContent}
`;
}
function compositionWithImplicitBodyPrefix(prefixContent: string): string {
return `
${prefixContent}
`;
}
function templateCompositionWithHead(headContent: string): string {
return `
${headContent}
`;
}
describe("core rules", () => {
it("does not lint scripts embedded inside an iframe srcdoc attribute", async () => {
const html = `
`;
const result = await lintHyperframeHtml(html);
expect(
result.findings.find((finding) => finding.code === "invalid_inline_script_syntax"),
).toBeUndefined();
expect(
result.findings.find((finding) => finding.code === "gsap_timeline_not_registered"),
).toBeUndefined();
});
it("does not lint elements embedded inside an iframe srcdoc attribute", async () => {
const html = `
`;
const result = await lintHyperframeHtml(html);
expect(
result.findings.find(
(finding) => finding.elementId === undefined && finding.message.includes("