Show seven cards on the four method decks and open each as a routing overlay of its parts, so groups write from empty fields with Generate draft, search the full deck, and see unselected scope chips with enough contrast.

This commit is contained in:
adilallo committed 2026-11-05 22:43:30 -07:00
1 parent dea7dd7fbd
commit 46656f52d3
28 files changed
+1349 -318

No files matched your search

@@ -0,0 +1,56 @@
import { describe, expect, it, vi } from "vitest";
import { fireEvent } from "@testing-library/react";
import "@testing-library/jest-dom/vitest";
import {
renderWithProviders as render,
screen,
within,
} from "../utils/test-utils";
import { MethodCardPolicyDialog } from "../../app/(app)/create/components/MethodCardPolicyDialog";
import type { MethodCardPolicyStep } from "../../app/(app)/create/components/MethodCardPolicyDialog";
const steps: MethodCardPolicyStep[] = [
{
id: "core",
title: "Core principle and scope",
emptyDescription: "Write this part of the policy.",
done: false,
summary: "",
renderEditor: () => (
<textarea aria-label="Core principle and scope" defaultValue="" />
),
},
];
describe("MethodCardPolicyDialog", () => {
it("routes through a step then Add to Rule", () => {
const onConfirm = vi.fn();
render(
<MethodCardPolicyDialog
isOpen
cardLabel="Signal"
editing={false}
steps={steps}
onClose={() => undefined}
onConfirm={onConfirm}
/>,
);
const dialog = screen.getByRole("dialog");
expect(
within(dialog).getByRole("button", { name: "Add to Rule" }),
).toBeInTheDocument();
fireEvent.click(
within(dialog).getByRole("button", { name: "Core principle and scope" }),
);
expect(
within(dialog).getByRole("textbox", { name: "Core principle and scope" }),
).toBeInTheDocument();
fireEvent.click(within(dialog).getByRole("button", { name: "Save" }));
expect(
within(dialog).getByRole("button", { name: "Add to Rule" }),
).toBeInTheDocument();
fireEvent.click(within(dialog).getByRole("button", { name: "Add to Rule" }));
expect(onConfirm).toHaveBeenCalledTimes(1);
});
});