Reuse preview sanitizer across client page bundles
This commit is contained in:
1 parent
646814d6df
commit
a023049431
4 files changed
+20
-5
No files matched your search
@@ -11,3 +11,15 @@ test("preview sanitization preserves email layout and editor markers but removes
|
||||
expect(result).not.toMatch(/onerror|javascript:|<script|<iframe/);
|
||||
window.close();
|
||||
});
|
||||
|
||||
test("separately bundled preview modules reuse one realm sanitizer", async () => {
|
||||
const { window } = new JSDOM("");
|
||||
const doc = window.document as unknown as Document;
|
||||
builderPreviewHTML("<p>First page</p>", doc);
|
||||
const key = Symbol.for("wrnexus.block-editor.preview-sanitizer");
|
||||
const first = (window as any)[key];
|
||||
const secondModule = await import("../src/preview-html.ts?second-page");
|
||||
expect(String(secondModule.builderPreviewHTML("<p>Second page</p>", doc))).toContain("Second page");
|
||||
expect((window as any)[key]).toBe(first);
|
||||
window.close();
|
||||
});
|
||||
Reference in new issue
Block a user