feat(project): add Asana-style board completion checks
This commit is contained in:
@@ -525,6 +525,33 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
check("[옵션] 폰트 로딩 실패는 이전 설정 유지·재시도 가능", dialog.open && !d.getElementById("pj-options-error").hidden && !select.disabled && w.localStorage.getItem("pj_font") === "pretendard");
|
||||
}
|
||||
|
||||
// 카드 완료 체크 — 상세창과 분리, 중복 요청·실패 복구·읽기 전용.
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env); const d = env.d, w = env.w;
|
||||
const seed = JSON.parse(d.getElementById("pj-data").textContent);
|
||||
seed.tasks.find(function (t) { return t.id === 301; }).stage_id = 11;
|
||||
d.getElementById("pj-data").textContent = JSON.stringify(seed);
|
||||
const P = await boot(env);
|
||||
const pending = deferred(); env.route("PUT", /tasks\/101$/, function () { return pending.promise; });
|
||||
const button = function () { return d.querySelector('.pj-card[data-task-id="101"] .pj-card-check'); };
|
||||
const puts = function () { return env.calls.filter(function (c) { return c.method === "PUT" && /tasks\/101$/.test(c.url); }); };
|
||||
check("[카드 완료] 미완료는 선택되지 않은 원형 체크", button().getAttribute("role") === "checkbox" && button().getAttribute("aria-checked") === "false");
|
||||
button().focus(); button().click(); button().dispatchEvent(new w.MouseEvent("click", { bubbles: true })); await settle();
|
||||
check("[카드 완료] 체크는 상세창 없이 완료 요청 한 번", puts().length === 1 && puts()[0].body.completed === true && d.getElementById("pj-modal-task").hidden && button().disabled);
|
||||
pending.resolve({ body: { task: detail(101, "작업 A", { completed_at: "2026-10-02" }) } }); await settle();
|
||||
check("[카드 완료] 서버 응답 뒤 완료 카드·체크·포커스 반영", !!taskOf(P, 101).completed_at && button().getAttribute("aria-checked") === "true" && !button().disabled && button().closest(".pj-card").classList.contains("is-done") && d.activeElement === button());
|
||||
env.route("PUT", /tasks\/101$/, function () { return { status: 500, body: { detail: "잠시 오류" } }; });
|
||||
button().click(); await settle();
|
||||
check("[카드 완료] 실패하면 완료 상태 유지·버튼 재시도 가능", button().getAttribute("aria-checked") === "true" && !button().disabled && puts()[1].body.completed === false);
|
||||
env.route("PUT", /tasks\/101$/, function () { return { body: { task: detail(101, "작업 A") } }; });
|
||||
button().click(); await settle();
|
||||
check("[카드 완료] 다시 누르면 완료 취소", !taskOf(P, 101).completed_at && button().getAttribute("aria-checked") === "false" && !button().closest(".pj-card").classList.contains("is-done"));
|
||||
const read = d.querySelector('.pj-card[data-task-id="301"] .pj-card-check'), before = env.calls.length;
|
||||
check("[카드 완료] 연결된 읽기 전용 작업은 비활성 체크", !!read && read.disabled);
|
||||
read.dispatchEvent(new w.MouseEvent("click", { bubbles: true })); await settle();
|
||||
check("[카드 완료] 읽기 전용 체크는 서버 요청을 보내지 않음", env.calls.length === before);
|
||||
}
|
||||
|
||||
clearTimeout(WATCHDOG);
|
||||
console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS");
|
||||
process.exit(fails.length ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user