Align custom policy details with the Figma create modal so the add-field control, copy, and labels match the intended styling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
adilallo
2026-08-25 09:49:10 -06:00
co-authored by Cursor
parent 963fa03c5c
commit 712437edc7
13 changed files with 88 additions and 60 deletions
@@ -442,7 +442,7 @@ describe("CommunicationMethodsScreen — Add Platform persistence", () => {
expect(
screen.getByRole("button", { name: "Core Principle & Scope" }),
).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Finalize" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize policy" }));
await waitFor(() => {
expect(latest.customMethodCardMetaById?.[customId]?.label).toBe(
@@ -493,7 +493,7 @@ describe("CommunicationMethodsScreen — Add Platform persistence", () => {
});
fireEvent.click(screen.getByRole("button", { name: "Next" }));
fireEvent.click(screen.getByRole("button", { name: "Next" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize policy" }));
await waitFor(() => {
expect(latest.customMethodCardMetaById?.signal?.label).toBe(
@@ -546,7 +546,7 @@ describe("CommunicationMethodsScreen — Add Platform persistence", () => {
fireEvent.dragStart(rows[0], { dataTransfer });
fireEvent.drop(rows[2], { dataTransfer });
fireEvent.click(screen.getByRole("button", { name: "Finalize" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize policy" }));
await waitFor(() => {
expect(
@@ -235,7 +235,7 @@ describe("CoreValuesSelectScreen", () => {
fireEvent.dragStart(rows[0], { dataTransfer });
fireEvent.drop(rows[1], { dataTransfer });
fireEvent.click(screen.getByRole("button", { name: "Finalize" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize policy" }));
await waitFor(() => {
expect(
@@ -288,9 +288,53 @@ describe("CoreValuesSelectScreen", () => {
target: { value: "A community-authored value." },
});
fireEvent.click(screen.getByRole("button", { name: "Next" }));
fireEvent.click(await screen.findByRole("button", { name: "Finalize" }));
expect(
await screen.findByText("Custom policy details"),
).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Add Custom Field" }),
).toBeInTheDocument();
fireEvent.click(await screen.findByRole("button", { name: "Finalize policy" }));
}
it("collapses the field-type picker after adding a custom field", async () => {
renderWithProviders(<CoreValuesSelectScreen />);
fireEvent.click(screen.getByRole("button", { name: "Add value" }));
fireEvent.change(await screen.findByPlaceholderText("Policy name"), {
target: { value: CUSTOM_LABEL },
});
fireEvent.click(screen.getByRole("button", { name: "Next" }));
fireEvent.change(
await screen.findByPlaceholderText("Policy description"),
{ target: { value: "A community-authored value." } },
);
fireEvent.click(screen.getByRole("button", { name: "Next" }));
expect(
await screen.findByText("Custom policy details"),
).toBeInTheDocument();
const wizard = screen.getByRole("dialog");
fireEvent.click(
within(wizard).getByRole("button", { name: "Add Custom Field" }),
);
fireEvent.click(within(wizard).getByRole("button", { name: "Text" }));
fireEvent.change(
await screen.findByPlaceholderText("Add your text block title"),
{ target: { value: "Policy title" } },
);
fireEvent.click(screen.getByRole("button", { name: "Add field" }));
expect(
await within(wizard).findByRole("button", { name: "Add Custom Field" }),
).toBeInTheDocument();
expect(
within(wizard).queryByRole("button", { name: "Text" }),
).not.toBeInTheDocument();
expect(
within(wizard).getByRole("button", { name: "Policy title" }),
).toBeInTheDocument();
});
it("opens the empty custom-policy wizard from Add value", async () => {
renderWithProviders(<CoreValuesSelectScreen />);
fireEvent.click(screen.getByRole("button", { name: "Add value" }));
+2 -2
View File
@@ -829,7 +829,7 @@ describe("FinalReviewScreen — chip edit modal save semantics", () => {
fireEvent.change(nameInput, { target: { value: "Custom Signal header" } });
fireEvent.click(screen.getByRole("button", { name: "Next" }));
fireEvent.click(screen.getByRole("button", { name: "Next" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize policy" }));
await waitFor(() => {
expect(latest.customMethodCardMetaById?.signal?.label).toBe(
@@ -883,7 +883,7 @@ describe("FinalReviewScreen — chip edit modal save semantics", () => {
fireEvent.dragStart(rows[0], { dataTransfer });
fireEvent.drop(rows[2], { dataTransfer });
fireEvent.click(screen.getByRole("button", { name: "Finalize" }));
fireEvent.click(screen.getByRole("button", { name: "Finalize policy" }));
await waitFor(() => {
expect(