feat(web): code-aware field errors + min count validation (#46)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,24 @@ test("required core + required flexible field block submit", async () => {
|
||||
expect(onSubmit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("number_of_objects of 0 is blocked client-side with the minCount message", async () => {
|
||||
const onSubmit = vi.fn();
|
||||
renderApp(<ObjectForm mode="create" onSubmit={onSubmit} onCancel={() => {}} />);
|
||||
|
||||
await userEvent.type(await screen.findByLabelText(/object number/i), "A-9");
|
||||
await userEvent.type(screen.getByLabelText(/^name/i), "Amphora");
|
||||
await userEvent.type(screen.getByLabelText(/inscription/i), "To the gods");
|
||||
|
||||
const count = screen.getByLabelText(/number of objects/i);
|
||||
await userEvent.clear(count);
|
||||
await userEvent.type(count, "0");
|
||||
|
||||
await userEvent.click(screen.getByRole("button", { name: /create object/i }));
|
||||
|
||||
expect(await screen.findByText("Must be at least 1")).toBeInTheDocument();
|
||||
expect(onSubmit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("edit mode: no visibility control, save button, prefilled values", async () => {
|
||||
const onSubmit = vi.fn();
|
||||
renderApp(
|
||||
|
||||
Reference in New Issue
Block a user