Keep catalog method section editors after a Customize title override so Core Principle and related copy are not replaced by an empty custom-policy body.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,8 @@ import "@testing-library/jest-dom/vitest";
|
||||
import { CommunicationMethodsScreen } from "../../app/(app)/create/screens/card/CommunicationMethodsScreen";
|
||||
import { useCreateFlow } from "../../app/(app)/create/context/CreateFlowContext";
|
||||
import type { CreateFlowState } from "../../app/(app)/create/types";
|
||||
import { communicationPresetFor } from "../../lib/create/finalReviewChipPresets";
|
||||
import messages from "../../messages/en/index";
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
@@ -158,6 +160,48 @@ describe("CommunicationMethodsScreen — Add Platform persistence", () => {
|
||||
expect(textareas[2].value).toBe("Saved coc");
|
||||
});
|
||||
|
||||
it("keeps catalog section editors when a title override exists and there are no custom fields", async () => {
|
||||
const details = communicationPresetFor("video-meetings");
|
||||
const noFieldsHint =
|
||||
messages.create.customRule.customMethodCardWizard.editModal
|
||||
.noCustomFieldsYet;
|
||||
render(
|
||||
<ScreenWithStateProbe
|
||||
onState={() => {
|
||||
/* noop */
|
||||
}}
|
||||
initial={{
|
||||
selectedCommunicationMethodIds: ["video-meetings"],
|
||||
customMethodCardMetaById: {
|
||||
"video-meetings": {
|
||||
label: "Video Meetings",
|
||||
supportText:
|
||||
"Synchronous video calls for remote face-to-face interaction.",
|
||||
},
|
||||
},
|
||||
communicationMethodDetailsById: {
|
||||
"video-meetings": details,
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
screen.getAllByRole("button", {
|
||||
name: /Video Meetings: Synchronous video/,
|
||||
})[0],
|
||||
);
|
||||
const dialog = await screen.findByRole("dialog");
|
||||
const textareas = within(dialog).getAllByRole(
|
||||
"textbox",
|
||||
) as HTMLTextAreaElement[];
|
||||
expect(textareas).toHaveLength(3);
|
||||
expect(textareas[0].value).toBe(details.corePrinciple);
|
||||
expect(textareas[1].value).toBe(details.logisticsAdmin);
|
||||
expect(textareas[2].value).toBe(details.codeOfConduct);
|
||||
expect(within(dialog).queryByText(noFieldsHint)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("opens meaning fields editable without Customize", async () => {
|
||||
render(
|
||||
<ScreenWithStateProbe
|
||||
|
||||
Reference in New Issue
Block a user