fix: 요약이 문장 중간에서 멈추지 않게 하고 남은 자리를 보여 준다

요약 칸이 300자에서 말없이 입력을 멈췄다. 아무 표시가 없어 키보드가
고장 난 것처럼 보인다.

계약 상한을 600 으로 올리고(입력·공개 렌더 모델 함께) 칸 아래에
`412 / 600` 을 둔다. 한계에 닿으면 붉게 바뀐다.

글자 수는 label 밖에 둔다. 안에 두면 label 의 글자가 모두 칸의 이름이
되어 이름이 "요약 412 / 600" 으로 타자마다 바뀐다 — 기존 테스트 둘이
실제로 그것을 잡아냈다. 읽어 주는 것은 한계에 닿는 순간뿐이다. 글자마다
세어 읽으면 받아쓰기가 된다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-08-29 22:07:54 +09:00
co-authored by Claude Opus 5
parent df371d38bd
commit 8fce8ea69c
8 changed files with 61 additions and 13 deletions
@@ -38,7 +38,9 @@ function renderEditor(
function labelsIn(container: HTMLElement, selector: string): string[] {
return Array.from(
container.querySelectorAll<HTMLElement>(selector),
(label) => label.querySelector(":scope > span")?.textContent ?? "",
// 칸 이름은 보통 `<label><span>이름</span>` 이지만, 요약처럼 label 을 htmlFor 로 잇는
// 칸도 있다 — 두 모양 다 같은 이름 목록에 실려야 순서를 볼 수 있다.
(field) => field.querySelector(":scope > span, :scope > label")?.textContent ?? "",
);
}
@@ -236,6 +238,31 @@ describe("TechLog Studio document editor", () => {
);
});
it("shows how much of the summary limit is left and keeps that limit at the contract's", async () => {
renderEditor(FIXTURE_IDS.edgeTokenQuestion);
const summary = await screen.findByLabelText("요약");
/*
계약 WorkingCopyInputBase.summary 와 같은 값이어야 한다. 300 이던 시절 이 칸은 문장
중간에서 말없이 입력을 멈췄고, 쓰는 사람에게는 키보드가 고장 난 것처럼 보였다.
*/
expect(summary).toHaveAttribute("maxlength", "600");
fireEvent.change(summary, { target: { value: "가".repeat(412) } });
expect(screen.getByText("412 / 600")).toBeInTheDocument();
expect(
screen.queryByText(/600자까지 모두 썼습니다/),
).not.toBeInTheDocument();
fireEvent.change(summary, { target: { value: "가".repeat(600) } });
expect(screen.getByText("600 / 600")).toBeInTheDocument();
// 한계에 닿았을 때만 알린다 — 글자마다 읽어 주면 받아쓰기가 된다.
expect(screen.getByText(/600자까지 모두 썼습니다/)).toBeInTheDocument();
// 글자 수는 칸의 이름에 섞이지 않아야 한다. 섞이면 이름이 타자마다 바뀐다.
expect(screen.getByLabelText("요약")).toBe(summary);
});
it("renders source not-found and retry surfaces for document loading", async () => {
const unknown = renderEditor("aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa");
expect(