Walk Create Community through the Figma screens and restore a chosen logo after reload, so a guest can leave without saving until they reach the email step.

This commit is contained in:
adilallo committed 2026-11-05 16:14:04 -07:00
1 parent ca1f58a50c
commit 2348a9e94f
61 files changed
+1110 -421

No files matched your search

+9 -18
View File
@@ -5,7 +5,6 @@ import {
fireEvent,
cleanup,
} from "../utils/test-utils";
import userEvent from "@testing-library/user-event";
import "@testing-library/jest-dom/vitest";
import { CommunityUploadScreen } from "../../app/(app)/create/screens/upload/CommunityUploadScreen";
import {
@@ -70,7 +69,7 @@ describe("CommunityUploadScreen", () => {
render(<CommunityUploadScreen />);
expect(
screen.getByRole("heading", {
name: "Add a photo to identify your group",
name: "Add a logo",
}),
).toBeInTheDocument();
});
@@ -80,13 +79,12 @@ describe("CommunityUploadScreen", () => {
expect(screen.getByRole("button", { name: "Upload" })).toBeInTheDocument();
expect(
screen.getByText(
/This photo will be used as a profile picture for your group/i,
/Only people who can read your Rule can see this image/i,
),
).toBeInTheDocument();
});
it("restores a pending IndexedDB photo and lets the user remove it", async () => {
const user = userEvent.setup();
it("restores a pending IndexedDB photo into the uploaded preview", async () => {
const pending = new File([pngBytes], "avatar.png", { type: "image/png" });
vi.mocked(readPendingCommunityAvatarFile).mockResolvedValue(pending);
@@ -94,22 +92,15 @@ describe("CommunityUploadScreen", () => {
const preview = await screen.findByRole("img", { name: copy.previewAlt });
expect(preview).toHaveAttribute("src", "blob:pending-avatar");
const remove = screen.getByRole("button", {
name: copy.clearPendingUploadAriaLabel,
});
await user.click(remove);
expect(clearPendingCommunityAvatarFile).toHaveBeenCalled();
expect(screen.getByRole("button", { name: "Upload" })).toBeInTheDocument();
expect(
screen.queryByRole("img", { name: copy.previewAlt }),
).not.toBeInTheDocument();
screen.getByRole("button", { name: copy.replaceButton }),
).toBeInTheDocument();
expect(screen.getByText("avatar.png")).toBeInTheDocument();
});
it("rejects an empty file with a clear error and does not stage it", async () => {
render(<CommunityUploadScreen />);
await screen.findByText(copy.signInToUploadNote);
await screen.findByRole("heading", { name: copy.title });
fireEvent.change(fileInput(), {
target: { files: [new File([], "empty.png", { type: "image/png" })] },
@@ -123,7 +114,7 @@ describe("CommunityUploadScreen", () => {
it("rejects a text file renamed as PNG", async () => {
render(<CommunityUploadScreen />);
await screen.findByText(copy.signInToUploadNote);
await screen.findByRole("heading", { name: copy.title });
fireEvent.change(fileInput(), {
target: {
@@ -139,7 +130,7 @@ describe("CommunityUploadScreen", () => {
it("rejects SVG uploads", async () => {
render(<CommunityUploadScreen />);
await screen.findByText(copy.signInToUploadNote);
await screen.findByRole("heading", { name: copy.title });
fireEvent.change(fileInput(), {
target: {