Open a template from its cards even when a saved draft exists.
This commit is contained in:
1 parent
851133e56d
commit
55b071aa83
11 files changed
+326
-140
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildAppliedTemplateCreateFlowState,
|
||||
buildCoreValuesPrefillFromTemplateBody,
|
||||
buildTemplateCustomizePrefill,
|
||||
templatePresetDetailsFromPrefill,
|
||||
@@ -224,6 +225,31 @@ describe("buildTemplateCustomizePrefill from templateChips.json", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildAppliedTemplateCreateFlowState", () => {
|
||||
it("starts from the template and drops leftover draft identity", () => {
|
||||
const seeded = buildAppliedTemplateCreateFlowState({
|
||||
slug: "mutual-aid-mondays",
|
||||
body: {
|
||||
sections: [
|
||||
{
|
||||
categoryName: "Communication",
|
||||
entries: [{ title: "Signal" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
mode: "useWithoutChanges",
|
||||
});
|
||||
expect(seeded.title).toBeUndefined();
|
||||
expect(seeded.communityAvatarUrl).toBeUndefined();
|
||||
expect(seeded.setupTraits).toBeUndefined();
|
||||
expect(seeded.selectedCommunicationMethodIds).toEqual(["signal"]);
|
||||
expect(seeded.pendingTemplateAction).toEqual({
|
||||
slug: "mutual-aid-mondays",
|
||||
mode: "useWithoutChanges",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("templatePresetDetailsFromPrefill", () => {
|
||||
it("fills catalog copy for each prefilled chip", () => {
|
||||
const details = templatePresetDetailsFromPrefill({
|
||||
|
||||
Reference in new issue
Block a user