fix(email-renderer): preserve valid column table structure
This commit is contained in:
1 parent
ad81306625
commit
d8b9c2dcb5
3 files changed
+38
-3
No files matched your search
@@ -73,6 +73,41 @@ describe("email renderer", () => {
|
||||
expect((await validateAmpEmail("<html></html>")).valid).toBe(false);
|
||||
});
|
||||
|
||||
test("keeps rendered block rows inside valid column tables", async () => {
|
||||
const columnDocument = structuredClone(document);
|
||||
const content = columnDocument.root.slots.content[0]!.slots.content;
|
||||
columnDocument.root.slots.content[0]!.slots.content = [
|
||||
{
|
||||
id: "columns",
|
||||
type: "layout.columns",
|
||||
version: 1,
|
||||
props: {},
|
||||
styles: {},
|
||||
slots: {
|
||||
columns: [
|
||||
{
|
||||
id: "column",
|
||||
type: "layout.column",
|
||||
version: 1,
|
||||
props: { width: "100%" },
|
||||
styles: {},
|
||||
slots: { content },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
const rendered = await renderEmail(columnDocument, { amp: true });
|
||||
expect(rendered.ok).toBe(true);
|
||||
if (!rendered.ok) return;
|
||||
expect(rendered.value.parts.html.content).toContain(
|
||||
'data-block-id="column" class="wrn-column" width="100%" valign="top"><table role="presentation"',
|
||||
);
|
||||
expect(rendered.value.parts.html.content).toContain(
|
||||
'<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td data-block-id="heading"',
|
||||
);
|
||||
});
|
||||
|
||||
test("compiles only allowlisted semantic styles", async () => {
|
||||
const styled = structuredClone(document);
|
||||
styled.root.slots.content[0]!.slots.content[0]!.styles = {
|
||||
|
||||
Reference in new issue
Block a user