fix(email-renderer): stack columns only at compact widths
Quality / quality (ubuntu-latest) (push) Failing after 10m1s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
Clintchiz committed 2026-09-05 12:44:09 +05:30
1 parent d1f42e0566
commit fd777605e1
3 files changed
+12 -3

No files matched your search

@@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test";
import { parse, type DefaultTreeAdapterMap } from "parse5";
import {
emailCoreBlocks,
emailKind,
renderEmail,
validateAmpEmail,
validateMjml,
@@ -56,6 +57,14 @@ const document: BlockDocument = {
};
describe("email renderer", () => {
test("responsive stacking begins below the desktop email width", async () => {
const rendered = await renderEmail(document);
expect(rendered.ok).toBe(true);
if (!rendered.ok) return;
expect(emailKind.breakpoints.compact).toBe(480);
expect(rendered.value.parts.html.content).toContain("max-width:480px");
expect(rendered.value.parts.html.content).not.toContain("max-width:620px");
});
test("countdown URLs are derived for HTML AMP and MJML without mutating the document", async () => {
const draft = structuredClone(document);
draft.root.slots.content[0]!.slots.content = [{id:"timer",type:"content.countdown",version:1,props:{label:"Offer ends",deadline:"2026-10-01T00:00:00Z",fallback:"Offer ended"},styles:{},slots:{}}];