Show the whole Rule on one review card, with quiet flags for missing cards and Continue once each question has one.
This commit is contained in:
1 parent
cc878e3c19
commit
6e2e1915ae
30 files changed
+571
-218
No files matched your search
@@ -64,4 +64,14 @@ describe("Chip", () => {
|
||||
expect(chip).toHaveAttribute("aria-pressed", "true");
|
||||
expect(chip.querySelector("svg[aria-hidden]")).not.toBeNull();
|
||||
});
|
||||
|
||||
it("shows a warning icon and names the missing words", () => {
|
||||
render(
|
||||
<Chip label="Signal" state="unselected" hasWarning />,
|
||||
);
|
||||
const chip = screen.getByRole("button", {
|
||||
name: "Signal, missing words",
|
||||
});
|
||||
expect(chip.querySelector("svg")).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -14,7 +14,9 @@ import { clearCoreValueDetailsLocalStorage } from "../../app/(app)/create/utils/
|
||||
import type { CreateFlowState } from "../../app/(app)/create/types";
|
||||
|
||||
function catalogChipName(label: string) {
|
||||
return new RegExp(`^(Select|Deselect) ${label}$`);
|
||||
return new RegExp(
|
||||
`^((Select|Deselect) ${label}|${label}, missing words)$`,
|
||||
);
|
||||
}
|
||||
|
||||
async function confirmDiscardCustomizeEdits() {
|
||||
@@ -75,7 +77,7 @@ describe("FinalReviewScreen", () => {
|
||||
render(<FinalReviewScreen />);
|
||||
expect(
|
||||
screen.getByRole("heading", {
|
||||
name: "Review your CommunityRule",
|
||||
name: "Review your Rule",
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
@@ -83,9 +85,7 @@ describe("FinalReviewScreen", () => {
|
||||
it("renders lockup description", () => {
|
||||
render(<FinalReviewScreen />);
|
||||
expect(
|
||||
screen.getByText(
|
||||
/Here's what other people will see. Make sure everything looks good before you publish. Once the rule is published, you must use one of your decision-making mechanisms to edit it again./i,
|
||||
),
|
||||
screen.getByText("Here's what other people will see."),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -182,11 +182,19 @@ describe("FinalReviewScreen", () => {
|
||||
expect(screen.getByText("Conflict management")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders category chips", () => {
|
||||
it("shows add chips and flags when no cards or values are picked", () => {
|
||||
render(<FinalReviewScreen />);
|
||||
expect(screen.getByText("Consciousness")).toBeInTheDocument();
|
||||
expect(screen.getByText("Signal")).toBeInTheDocument();
|
||||
expect(screen.getByText("Open Admission")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("No values yet. You can add them any time."),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getAllByText("No card yet. Add one before you finish.").length,
|
||||
).toBe(4);
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Add value" }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getAllByRole("button", { name: "Add card" })).toHaveLength(4);
|
||||
expect(screen.queryByText("Consciousness")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -225,10 +233,10 @@ describe("FinalReviewScreen — prefilled selections", () => {
|
||||
expect(screen.getByText("Lazy consensus")).toBeInTheDocument();
|
||||
expect(screen.getByText("Conflict ladder")).toBeInTheDocument();
|
||||
|
||||
// Demo chips from `finalReview.json` must not leak through once the
|
||||
// user has real selections. The fallback still says "Open Admission".
|
||||
expect(screen.queryByText("Open Admission")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Consciousness")).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Signal, missing words" }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("warns when binding arbitration sits next to a join that records no yes", async () => {
|
||||
@@ -1293,15 +1301,15 @@ describe("FinalReviewScreen — edit published title and description", () => {
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not expose click-to-edit title or description on default final review", () => {
|
||||
it("exposes click-to-edit title and description on default final review", () => {
|
||||
render(
|
||||
<FinalReviewWithFlowState
|
||||
title="Oak"
|
||||
communityContext="Visible body"
|
||||
/>,
|
||||
);
|
||||
expect(screen.queryByTestId("rule-title-edit")).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId("rule-description-edit")).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId("rule-title-edit")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("rule-description-edit")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("opens Save modal from title click and updates title", async () => {
|
||||
|
||||
@@ -287,4 +287,18 @@ describe("MultiSelect – behaviour specifics", () => {
|
||||
);
|
||||
expect(screen.getByText("Pick one")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows a flag after the add chip in the same row", () => {
|
||||
render(
|
||||
<MultiSelect
|
||||
options={[]}
|
||||
addButton
|
||||
addButtonText="Add card"
|
||||
flag="No card yet. Add one before you finish."
|
||||
/>,
|
||||
);
|
||||
expect(
|
||||
screen.getByText("No card yet. Add one before you finish."),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user