Run Use without changes through name, description, and photo so final review never holds an editable field.
This commit is contained in:
1 parent
53e27ef122
commit
6bf890fa78
13 files changed
+156
-145
No files matched your search
@@ -1334,6 +1334,36 @@ describe("FinalReviewScreen — edit published title and description", () => {
|
||||
expect(screen.getByTestId("rule-description-edit")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows name and description as text on the template path, with no text input", async () => {
|
||||
function TemplatePathHarness() {
|
||||
const { replaceState } = useCreateFlow();
|
||||
useLayoutEffect(() => {
|
||||
replaceState({
|
||||
title: "Eastside Tenants Union",
|
||||
communityContext: "Neighbors sharing a building.",
|
||||
pendingTemplateAction: {
|
||||
slug: "woodline",
|
||||
mode: "useWithoutChanges",
|
||||
},
|
||||
});
|
||||
}, [replaceState]);
|
||||
return <FinalReviewScreen />;
|
||||
}
|
||||
render(<TemplatePathHarness />);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Eastside Tenants Union")).toBeInTheDocument();
|
||||
});
|
||||
expect(
|
||||
screen.getByText("Neighbors sharing a building."),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("textbox", { name: /Community name/i }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("textbox"),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("opens Save modal from title click and updates title", async () => {
|
||||
let latest: CreateFlowState = {};
|
||||
render(
|
||||
|
||||
@@ -196,10 +196,10 @@ describe("CommunityReviewScreen — pendingTemplateAction redirect", () => {
|
||||
expect(testRouter.push).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("redirects Use without changes leftover pins to final review", async () => {
|
||||
it("redirects Use without changes leftover pins to the name screen", async () => {
|
||||
render(<ReviewWithPendingAction mode="useWithoutChanges" />);
|
||||
await waitFor(() => {
|
||||
expect(testRouter.replace).toHaveBeenCalledWith("/create/final-review");
|
||||
expect(testRouter.replace).toHaveBeenCalledWith("/create/community-name");
|
||||
});
|
||||
expect(testRouter.push).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -113,29 +113,43 @@ describe("flowSteps", () => {
|
||||
expect(getPreviousStep("final-review", opts)).toBe("conflict-management");
|
||||
});
|
||||
|
||||
it("templatePathMode useWithoutChanges skips community setup and the decks", () => {
|
||||
it("templatePathMode useWithoutChanges runs name, description, and photo, then skips the decks", () => {
|
||||
const opts = { templatePathMode: "useWithoutChanges" as const };
|
||||
expect(getNextStep("informational", opts)).toBe("final-review");
|
||||
expect(getNextStep("community-name", opts)).toBe("final-review");
|
||||
expect(getNextStep("setup-questions", opts)).toBe("final-review");
|
||||
expect(getNextStep("informational", opts)).toBe("community-name");
|
||||
expect(getNextStep("community-name", opts)).toBe("community-context");
|
||||
expect(getNextStep("community-context", opts)).toBe("community-upload");
|
||||
expect(getNextStep("community-upload", opts)).toBe("final-review");
|
||||
expect(getNextStep("setup-questions", opts)).toBe("community-upload");
|
||||
expect(getNextStep("core-values", opts)).toBe("final-review");
|
||||
expect(getNextStep("final-review", opts)).toBe("confirm-stakeholders");
|
||||
expect(getPreviousStep("final-review", opts)).toBeNull();
|
||||
expect(getPreviousStep("community-name", opts)).toBeNull();
|
||||
expect(getPreviousStep("community-context", opts)).toBe("community-name");
|
||||
expect(getPreviousStep("community-upload", opts)).toBe("community-context");
|
||||
expect(getPreviousStep("final-review", opts)).toBe("community-upload");
|
||||
});
|
||||
|
||||
it("templatePathSkippedCommunityRedirect resumes setup steps and leaves decks", () => {
|
||||
expect(
|
||||
templatePathSkippedCommunityRedirect("setup-questions", "customize"),
|
||||
).toBe("core-values");
|
||||
expect(
|
||||
templatePathSkippedCommunityRedirect("community-name", "customize"),
|
||||
).toBe("core-values");
|
||||
expect(templatePathSkippedCommunityRedirect("review", "customize")).toBe(
|
||||
"core-values",
|
||||
);
|
||||
expect(
|
||||
templatePathSkippedCommunityRedirect(
|
||||
"setup-questions",
|
||||
"useWithoutChanges",
|
||||
),
|
||||
).toBe("community-name");
|
||||
expect(
|
||||
templatePathSkippedCommunityRedirect(
|
||||
"community-name",
|
||||
"useWithoutChanges",
|
||||
),
|
||||
).toBe("final-review");
|
||||
).toBeNull();
|
||||
expect(
|
||||
templatePathSkippedCommunityRedirect("core-values", "useWithoutChanges"),
|
||||
).toBeNull();
|
||||
@@ -153,17 +167,27 @@ describe("flowSteps", () => {
|
||||
templatePathMode: "useWithoutChanges" as const,
|
||||
};
|
||||
expect(getNextStep("community-upload", opts)).toBe("final-review");
|
||||
expect(getPreviousStep("final-review", opts)).toBeNull();
|
||||
expect(getPreviousStep("final-review", opts)).toBe("community-upload");
|
||||
});
|
||||
|
||||
it("resolveCreateFlowBackTarget returns template review from use-without-changes final-review", () => {
|
||||
it("resolveCreateFlowBackTarget returns template review from use-without-changes name", () => {
|
||||
expect(
|
||||
resolveCreateFlowBackTarget(
|
||||
"community-name",
|
||||
{ templatePathMode: "useWithoutChanges" },
|
||||
"mutual-aid-mondays",
|
||||
),
|
||||
).toEqual({ kind: "templateReview", slug: "mutual-aid-mondays" });
|
||||
});
|
||||
|
||||
it("resolveCreateFlowBackTarget returns photo from use-without-changes final-review", () => {
|
||||
expect(
|
||||
resolveCreateFlowBackTarget(
|
||||
"final-review",
|
||||
{ templatePathMode: "useWithoutChanges" },
|
||||
"mutual-aid-mondays",
|
||||
),
|
||||
).toEqual({ kind: "templateReview", slug: "mutual-aid-mondays" });
|
||||
).toEqual({ kind: "step", step: "community-upload" });
|
||||
});
|
||||
|
||||
it("resolveCreateFlowBackTarget returns template review from customize values", () => {
|
||||
@@ -186,10 +210,10 @@ describe("flowSteps", () => {
|
||||
).toEqual({ kind: "step", step: "conflict-management" });
|
||||
});
|
||||
|
||||
it("resolveCreateFlowBackTarget returns template review when a slug is set without a mode", () => {
|
||||
it("resolveCreateFlowBackTarget returns template review from name when a slug is set without a mode", () => {
|
||||
expect(
|
||||
resolveCreateFlowBackTarget(
|
||||
"final-review",
|
||||
"community-name",
|
||||
undefined,
|
||||
"mutual-aid-mondays",
|
||||
),
|
||||
|
||||
@@ -126,14 +126,14 @@ describe("useTemplateReviewActions", () => {
|
||||
expect(applied?.templateReviewBackSlug).toBe("mutual-aid-mondays");
|
||||
});
|
||||
|
||||
it("direct Use without changes goes to final review and clears leftover identity", async () => {
|
||||
it("direct Use without changes goes to the name screen and clears leftover identity", async () => {
|
||||
const { result } = renderActions({ title: "Neighborhood" });
|
||||
|
||||
await act(async () => {
|
||||
await result.current.handleUseWithoutChanges();
|
||||
});
|
||||
|
||||
expect(router.push).toHaveBeenCalledWith("/create/final-review");
|
||||
expect(router.push).toHaveBeenCalledWith("/create/community-name");
|
||||
expect(applied?.title).toBeUndefined();
|
||||
expect(applied?.communityContext).toBeUndefined();
|
||||
expect(applied?.communityAvatarUrl).toBeUndefined();
|
||||
@@ -159,7 +159,7 @@ describe("useTemplateReviewActions", () => {
|
||||
await result.current.handleUseWithoutChanges();
|
||||
});
|
||||
|
||||
expect(router.push).toHaveBeenCalledWith("/create/final-review");
|
||||
expect(router.push).toHaveBeenCalledWith("/create/community-name");
|
||||
expect(applied?.title).toBe("Neighborhood");
|
||||
expect(applied?.communityContext).toBe("We meet weekly");
|
||||
expect(applied?.setupTraits).toBeUndefined();
|
||||
|
||||
Reference in new issue
Block a user