Skip setup questions on the template path and collect name, photo, and description without recommendations.
Customize opens a dialog then walks the template decks; Use without changes lands on final review with Has Name Field. Template cards stay first, the engine is not called, and the catalog no longer shows a recommended tag.
This commit is contained in:
1 parent
53d236d0d5
commit
6498d52541
37 files changed
+1450
-733
No files matched your search
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildCoreValuesPrefillFromTemplateBody,
|
||||
buildTemplateCustomizePrefill,
|
||||
templatePresetDetailsFromPrefill,
|
||||
} from "../../lib/create/applyTemplatePrefill";
|
||||
import { methodSectionsPinsForHydratedSelections } from "../../lib/create/publishedDocumentToCreateFlowState";
|
||||
import coreValuesMessages from "../../messages/en/create/customRule/coreValues.json";
|
||||
@@ -196,3 +197,45 @@ describe("buildTemplateCustomizePrefill + method card pins", () => {
|
||||
expect(methodSectionsPinsForHydratedSelections(prefill)).toEqual({});
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildTemplateCustomizePrefill from templateChips.json", () => {
|
||||
it("prefers chip ids for a known slug over body titles", () => {
|
||||
const prefill = buildTemplateCustomizePrefill(
|
||||
{
|
||||
sections: [
|
||||
{
|
||||
categoryName: "Communication",
|
||||
entries: [{ title: "Signal" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
"consensus",
|
||||
);
|
||||
expect(prefill.selectedCommunicationMethodIds).toEqual([
|
||||
"how-we-run-meetings",
|
||||
"in-person-meetings",
|
||||
"loomio",
|
||||
]);
|
||||
expect(prefill.selectedCoreValueIds).toEqual([
|
||||
"consensus",
|
||||
"community-care",
|
||||
"horizontalism",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("templatePresetDetailsFromPrefill", () => {
|
||||
it("fills catalog copy for each prefilled chip", () => {
|
||||
const details = templatePresetDetailsFromPrefill({
|
||||
selectedCommunicationMethodIds: ["in-person-meetings"],
|
||||
selectedCoreValueIds: ["consensus"],
|
||||
});
|
||||
expect(
|
||||
details.communicationMethodDetailsById?.["in-person-meetings"]
|
||||
?.corePrinciple,
|
||||
).not.toBe("");
|
||||
expect(
|
||||
details.coreValueDetailsByChipId?.consensus?.meaning,
|
||||
).not.toBe("");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user