fix(email-renderer): honor explicit heading typography
Quality / quality (ubuntu-latest) (push) Canceled after 0s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
Clintchiz committed 2026-10-01 22:01:36 +05:30
1 parent 0a17867ae7
commit 62d1dd8bf3
4 files changed
+16 -3

No files matched your search

@@ -0,0 +1,13 @@
import { expect, test } from "bun:test";
import { renderEmail } from "../src/index.ts";
test("explicit heading sizes are not multiplied by browser heading defaults", async () => {
for (const size of [undefined, "36px", "expression(1)"]) {
const result = await renderEmail({schemaVersion:1,kind:"email",meta:{subject:"Typography",lang:"en"},theme:{tokens:{}},root:{id:"root",type:"layout.email-document",version:1,props:{width:"600"},styles:{},slots:{content:[{id:"heading",type:"content.heading",version:1,props:{text:"Design that works",level:"1"},styles:size?{fontSize:{base:size}}:{},slots:{}}]}}}, {amp:false,mjml:false});
expect(result.ok).toBe(true);
if (!result.ok) continue;
const html=result.value.parts.html.content;
expect(html.includes("font-size:inherit;line-height:1.2;")).toBe(size === "36px");
expect(html).not.toContain("expression(");
}
});