Found by the manual e2e of the production build: - paste guests preview counted an array, so it read "[object Object]" and never offered Save guests; - New event and Add user errors now clear when the field is fixed; - "Send to all unsent" says when nothing was unsent; - the check-in lookup shows an error on an empty submit and carries the typed email or mobile into the walk-in form; - invitation emails sent over Pub/Sub now save their recipient's link, so the Emails page shows the recipient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import { render, screen, waitFor } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { describe, it, expect, vi } from "vitest";
|
|
|
|
vi.mock("@/app/lib/services/adminRoles", () => ({ listAdminRoles: vi.fn().mockResolvedValue([]) }));
|
|
vi.mock("@/app/lib/AdminAuthContext", () => ({ useAdminAuth: vi.fn().mockReturnValue({ id: null }) }));
|
|
|
|
import { UserForm } from "./UserForm";
|
|
|
|
describe("UserForm error clearing", () => {
|
|
it("clears a field's error as soon as that field is filled", async () => {
|
|
render(<UserForm onSubmit={vi.fn()} />);
|
|
await userEvent.click(screen.getByRole("button", { name: /save|create|add/i }));
|
|
expect(await screen.findByText("Name is required.")).toBeInTheDocument();
|
|
|
|
await userEvent.type(screen.getByLabelText("Name"), "A");
|
|
await waitFor(() => expect(screen.queryByText("Name is required.")).not.toBeInTheDocument());
|
|
expect(screen.getByText("Email is required.")).toBeInTheDocument();
|
|
await userEvent.type(screen.getByLabelText("Email"), "a@x.my");
|
|
expect(screen.queryByText("Email is required.")).not.toBeInTheDocument();
|
|
});
|
|
});
|