Files
WRNexusJS/packages/email-renderer/test/heading-size.test.ts
T
Clintchiz 62d1dd8bf3
Quality / quality (ubuntu-latest) (push) Canceled after 0s
Quality / quality (windows-latest) (push) Canceled after 0s
fix(email-renderer): honor explicit heading typography
2026-10-01 22:01:36 +05:30

14 lines
888 B
TypeScript

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(");
}
});