test(form): 필드 이름이 붙은 결과 불명 시험을 고친 동작에 맞추고 상태 질의를 좁힌다
앞 커밋들을 FE-GATE-006으로 돌리자 form-foundation 시험 둘이 실패했다.
- 「keeps the save off after a 422 the backend may have applied」는 결과 불명
422가 필드 오류도 함께 보이기를 기대했다. 그것이 1101/03-04가 결함이라 한
동작이고 이 PR이 고쳤다(결과 불명을 입력 오류보다 먼저 본다). 시험이 결과
불명과 저장 막힘을 보고, 필드가 aria-invalid가 아님을 본다.
- 새 시험 「says a resend refused before the write in the feedback」은
findByRole("status")로 안내를 찾았는데, 시험 harness의 <output>도 status라
여럿이 걸렸다. 안내 문구를 찾고 그것을 감싼 결과 불명 status를 본다.
검증: form-foundation 전체를 desktop에서 돌린다(PR 본문).
Refs: 1101/03-04, 1112/04-02
This commit is contained in:
@@ -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 <output> 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") }),
|
||||
|
||||
Reference in New Issue
Block a user