41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
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(");
|
|
}
|
|
});
|