feat: release design system engine, studio and component contracts

This commit is contained in:
Clintchiz committed 2026-10-19 13:09:03 +05:30
1 parent ff1065fb27
commit 3943b946d6
693 files changed
+175546 -3894

No files matched your search

@@ -4,10 +4,15 @@ import { builderPreviewHTML } from "../src/preview-html.ts";
test("preview sanitization preserves email layout and editor markers but removes executable content", () => {
const { window } = new JSDOM("");
const result = String(builderPreviewHTML('<html><head><style>td{padding:12px}</style></head><body><table data-block-id="one"><tr><td><img src="https://example.com/a.png" onerror="alert(1)"><a href="javascript:alert(1)">Hello</a></td></tr></table><script>alert(1)</script><iframe src="https://example.com"></iframe></body></html>', window.document as unknown as Document));
const result = String(
builderPreviewHTML(
'<html><head><style>td{padding:12px}</style></head><body><table data-block-id="one"><tr><td><img src="https://example.com/a.png" onerror="alert(1)"><a href="javascript:alert(1)">Hello</a></td></tr></table><script>alert(1)</script><iframe src="https://example.com"></iframe></body></html>',
window.document as unknown as Document,
),
);
expect(result).toContain('data-block-id="one"');
expect(result).toContain('<table');
expect(result).toContain('<style>');
expect(result).toContain("<table");
expect(result).toContain("<style>");
expect(result).not.toMatch(/onerror|javascript:|<script|<iframe/);
window.close();
});
@@ -20,7 +25,9 @@ test("separately bundled preview modules reuse one realm sanitizer", async () =>
const first = (window as any)[key];
const secondPageModule = "../src/preview-html.ts?second-page";
const secondModule = await import(secondPageModule);
expect(String(secondModule.builderPreviewHTML("<p>Second page</p>", doc))).toContain("Second page");
expect(String(secondModule.builderPreviewHTML("<p>Second page</p>", doc))).toContain(
"Second page",
);
expect((window as any)[key]).toBe(first);
window.close();
});