Open each core value as a card of meaning and signals steps, so groups write their own words from an empty field with Generate draft, skip values without blocking the flow, and Customize without keeping helper text as the description.
This commit is contained in:
1 parent
2a7b9e6da7
commit
64a542f456
25 files changed
+877
-354
No files matched your search
@@ -358,6 +358,9 @@ describe("FinalReviewScreen — chip detail modal", () => {
|
||||
expect(
|
||||
screen.getByRole("menuitem", { name: /^customize$/i }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("menuitem", { name: /^remove$/i }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("values Customize starts on the policy name step", async () => {
|
||||
@@ -388,6 +391,8 @@ describe("FinalReviewScreen — chip detail modal", () => {
|
||||
await screen.findByPlaceholderText("Policy name"),
|
||||
).toHaveValue("Accessibility");
|
||||
expect(screen.queryByText("Custom policy details")).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Next" }));
|
||||
expect(screen.getByPlaceholderText("Policy description")).toHaveValue("");
|
||||
});
|
||||
|
||||
it("opens method chip modal editable, with Save disabled until a field changes", async () => {
|
||||
@@ -432,14 +437,48 @@ describe("FinalReviewScreen — chip detail modal", () => {
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.getByText(/what does this value mean to your group\?/i),
|
||||
screen.getByRole("button", {
|
||||
name: /what does this value mean to your community\?/i,
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
expect(
|
||||
screen.getByText(/signals of violation/i),
|
||||
screen.getByRole("button", { name: /signals of violation/i }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("starts a values meaning step empty and Generate draft inserts catalog copy", async () => {
|
||||
function CoreValuesHarness() {
|
||||
const { replaceState } = useCreateFlow();
|
||||
useLayoutEffect(() => {
|
||||
replaceState({
|
||||
selectedCoreValueIds: ["1"],
|
||||
coreValuesChipsSnapshot: [
|
||||
{ id: "1", label: "Accessibility", state: "selected" },
|
||||
],
|
||||
});
|
||||
}, [replaceState]);
|
||||
return <FinalReviewScreen />;
|
||||
}
|
||||
render(<CoreValuesHarness />);
|
||||
|
||||
fireEvent.click(
|
||||
await screen.findByRole("button", { name: catalogChipName("Accessibility") }),
|
||||
);
|
||||
const dialog = await screen.findByRole("dialog");
|
||||
fireEvent.click(
|
||||
within(dialog).getByRole("button", {
|
||||
name: /what does this value mean to your community\?/i,
|
||||
}),
|
||||
);
|
||||
const field = within(dialog).getByRole("textbox") as HTMLTextAreaElement;
|
||||
expect(field.value).toBe("");
|
||||
fireEvent.click(
|
||||
within(dialog).getByRole("button", { name: "Generate draft" }),
|
||||
);
|
||||
expect(field.value).toMatch(/usable by everyone/i);
|
||||
});
|
||||
|
||||
it("opens the editable Save modal for a values chip", async () => {
|
||||
// Plain custom-rule path: snapshot is set, sections is not.
|
||||
function CoreValuesHarness() {
|
||||
@@ -463,6 +502,12 @@ describe("FinalReviewScreen — chip detail modal", () => {
|
||||
expect(
|
||||
within(dialog).getByRole("button", { name: "Save" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
within(dialog).getByRole("button", { name: "Deselect" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
within(dialog).getByRole("button", { name: "Cancel" }),
|
||||
).toBeInTheDocument();
|
||||
expect(within(dialog).getAllByRole("button", { name: "Close" })).toHaveLength(
|
||||
1,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user