fix(email-renderer): include brand logos in AMP and MJML exports
Quality / quality (ubuntu-latest) (push) Failing after 1s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
Clintchiz committed 2026-09-05 13:17:23 +05:30
1 parent 612b3945ac
commit b915a2206f
3 files changed
+24 -3

No files matched your search

@@ -57,6 +57,27 @@ const document: BlockDocument = {
};
describe("email renderer", () => {
test("global brand logo survives HTML, AMP, and strict MJML export", async () => {
const draft = structuredClone(document);
draft.root.props.logoUrl = "https://example.com/logo.png";
draft.root.props.logoAlt = 'Brand & "Company"';
const result = await renderEmail(draft,{amp:true,mjml:true});
expect(result.ok).toBe(true);
if (!result.ok) return;
for (const output of [result.value.parts.html.content,result.value.parts.amp?.content,result.value.exports?.mjml]) {
expect(output).toContain('src="https://example.com/logo.png"');
expect(output).toContain('alt="Brand & "Company""');
}
expect(result.value.parts.amp?.validation.valid).toBe(true);
expect(await validateMjml(result.value.exports!.mjml!)).toEqual([]);
draft.root.props.logoUrl = "";
const empty = await renderEmail(draft,{amp:true,mjml:true});
expect(empty.ok).toBe(true);
if (empty.ok) {
expect(empty.value.parts.amp?.content).not.toContain("<amp-img");
expect(empty.value.exports?.mjml).not.toContain("<mj-image");
}
});
test("text line breaks survive all formats without interpreting entered markup", async () => {
const draft = structuredClone(document);
const text = 'First line\r\nSecond line\n\n<script>alert("x")</script>\rLast line';