Keep a continued draft on screen, ask before Edit drops rewritten copy, and retry clearing the draft after publish.
This commit is contained in:
1 parent
54a4871ad1
commit
7c08766092
11 files changed
+361
-41
No files matched your search
@@ -63,6 +63,66 @@ describe("publishedRuleEditWouldReplaceDraft", () => {
|
||||
};
|
||||
expect(publishedRuleEditWouldReplaceDraft(state, published)).toBe(true);
|
||||
});
|
||||
|
||||
it("is true when the same cards have different description, details, or field blocks", () => {
|
||||
const loaded = createFlowStateForEditingPublishedRule(published);
|
||||
|
||||
const rewrittenContext: CreateFlowState = {
|
||||
...loaded,
|
||||
communityContext: "A different description.",
|
||||
summary: "A different description.",
|
||||
};
|
||||
expect(
|
||||
createFlowStateMatchesPublishedRule(rewrittenContext, published),
|
||||
).toBe(false);
|
||||
expect(
|
||||
publishedRuleEditWouldReplaceDraft(rewrittenContext, published),
|
||||
).toBe(true);
|
||||
|
||||
const rewrittenMeaning: CreateFlowState = {
|
||||
...loaded,
|
||||
coreValueDetailsByChipId: {
|
||||
accountability: {
|
||||
meaning: "We changed what this means.",
|
||||
signals: "",
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(
|
||||
publishedRuleEditWouldReplaceDraft(rewrittenMeaning, published),
|
||||
).toBe(true);
|
||||
|
||||
const rewrittenMethod: CreateFlowState = {
|
||||
...loaded,
|
||||
communicationMethodDetailsById: {
|
||||
signal: {
|
||||
corePrinciple: "We say it out loud.",
|
||||
logisticsAdmin: "A shared thread.",
|
||||
codeOfConduct: "No pile-ons.",
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(publishedRuleEditWouldReplaceDraft(rewrittenMethod, published)).toBe(
|
||||
true,
|
||||
);
|
||||
|
||||
const rewrittenBlocks: CreateFlowState = {
|
||||
...loaded,
|
||||
customMethodCardFieldBlocksById: {
|
||||
signal: [
|
||||
{
|
||||
kind: "text",
|
||||
id: "notes",
|
||||
blockTitle: "Notes",
|
||||
placeholderText: "What changed",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
expect(publishedRuleEditWouldReplaceDraft(rewrittenBlocks, published)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("createFlowStateForEditingPublishedRule", () => {
|
||||
|
||||
Reference in new issue
Block a user