diff --git a/tests/component/form-foundation.test.tsx b/tests/component/form-foundation.test.tsx index b2d132ee..ab5ef831 100644 --- a/tests/component/form-foundation.test.tsx +++ b/tests/component/form-foundation.test.tsx @@ -1201,7 +1201,8 @@ describe("correcting a field after a server validation refusal", () => { // 1101/14.4. Outside IDEMPOTENT_REQUEST_MISMATCH a 422 may come after a // write (fileserver INTEGRITY_MISMATCH), so the coordinator holds it as an - // unknown result even though the form shows the field. + // unknown result. 1101/03-04. The form shows that result, not the field it + // names: correcting the field would send a second save. it("keeps the save off after a 422 the backend may have applied", async () => { const user = userEvent.setup(); const fetcher = answerFirst(422, { @@ -1215,8 +1216,11 @@ describe("correcting a field after a server validation refusal", () => { await user.type(name, "Rejected"); await user.click(screen.getByRole("button", { name: "Submit" })); - await waitFor(() => expect(name).toHaveAttribute("aria-invalid", "true")); + await waitFor(() => + expect(screen.getByTestId("result")).toHaveTextContent("effect-unknown"), + ); + expect(name).not.toHaveAttribute("aria-invalid"); expect(screen.getByRole("button", { name: "Submit" })).toBeDisabled(); expect(fetcher).toHaveBeenCalledTimes(1); }); @@ -1662,9 +1666,11 @@ describe("a form bound to its mutation", () => { ); await waitFor(() => expect(fetcher).toHaveBeenCalledTimes(2)); - const status = await screen.findByRole("status"); - await waitFor(() => - expect(status).toHaveTextContent(formatMessage("ko-KR", "form.resendLater")), + // The harness's elements are statuses too: find the words, then + // the unknown result's status around them. + const notice = await screen.findByText(formatMessage("ko-KR", "form.resendLater")); + expect(notice.closest('[role="status"]')).toHaveTextContent( + formatMessage("ko-KR", "async.mutationEffectUnknown"), ); expect( screen.queryByRole("heading", { name: formatMessage("ko-KR", "form.errorSummary") }),