Custom add and create flow polish

This commit is contained in:
adilallo
2026-05-08 20:32:24 -06:00
parent 26bcd61ea3
commit 026a1e6d71
68 changed files with 6208 additions and 527 deletions
+37
View File
@@ -188,6 +188,43 @@ describe("buildPublishPayload — methodSelections", () => {
expect(ms?.communication?.[0]?.label).toBe("Custom Comm");
});
it("embeds wizard field blocks in published Communication sections for custom UUID ids", () => {
const customId = "00000000-0000-4000-8000-000000000099";
const r = buildPublishPayload({
title: "T",
selectedCommunicationMethodIds: [customId],
sections: [
{
categoryName: "Communication",
entries: [{ title: "Template row", body: "placeholder" }],
},
],
customMethodCardMetaById: {
[customId]: { label: "Wizard title", supportText: "" },
},
customMethodCardFieldBlocksById: {
[customId]: [
{
kind: "text",
id: "b1",
blockTitle: "Field A",
placeholderText: "User-authored body",
},
],
},
});
expect(r.ok).toBe(true);
if (!r.ok) return;
const secs = r.document.sections as Array<{
categoryName: string;
entries: Array<{ blocks?: Array<{ label: string; body: string }> }>;
}>;
const comm = secs.find((s) => s.categoryName === "Communication");
expect(comm?.entries[0]?.blocks).toEqual([
{ label: "Field A", body: "User-authored body" },
]);
});
it("emits preset-only sections when a method is selected without an override", () => {
const r = buildPublishPayload({
title: "T",