"""면적산출 상세 오른쪽 일위대가 패널 · 칸 지정 모달(PLAN 39-4 D2 · D5 · D6) — 화면 조작은 ORCA. · 패널 = 그 열 일위대가 보기 갈래(`Labor_View`) · 조합 목록 · 찾기 · [이 열에 쓰기] · [조합 고치기] 없음 · 줄 누름 = 칸 지정 모달 → 스프레드시트 `setLink`(면적 문서 `연결` 한 곳 · 알약과 같은 길) · 시트 칸 값 · 연결이 바뀌면 `setQty` 로 바로 곱함(서버 안 부름) """ from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[2] M02 = ROOT / "M02_MasterTemplete" def _text(name: str) -> str: return (M02 / name).read_text(encoding="utf-8") def test_면적_길은_일위대가_패널(): main = _text("M02_MasterTemplete_UI_Main.ts") body = main.split("async function mountSheet")[1].split("async function remount")[0] area = body.split('if (kind === "area") {')[1].split("\n }\n")[0] assert "apanel = buildAreaPanel({" in area and "host.append(apanel.root);" in area assert "picked: () => picked," in area and "pills: () => links.항목," in area assert "apanel?.refresh();" in body and "onSelect: (s) => (picked = s.칸)," in body assert "buildComboBar" not in main # 조합 줄 · [조합 고치기] 지움 assert body.index('if (at.layer === "project") return;') < body.index("buildAreaPanel") assert "apanel?.destroy();\n apanel = null;" in main # drop def test_패널_몸은_보기_갈래_줄_누름은_칸_지정(): panel = _text("M02_MasterTemplete_AreaPanel.ts") assert "createLaborView(openLink)" in panel assert "void view.show(opts.layer, opts.column, quantities(opts.sheet()));" in panel assert "refresh: () => view.setQty(quantities(opts.sheet()))," in panel assert "openAreaLink({" in panel and "if (!row.pill) return showToast(TEXT.noPill" in panel for gone in ("fetchUsableCombos", "setColumnCombo", "branchCombo"): assert gone not in panel def test_칸_지정_모달은_setLink_만(): link = _text("M02_MasterTemplete_AreaLink.ts") assert "opts.sheet.setLink(opts.key, cell, opts.info)" in link assert "done(here)" in link and "done(address.input.value)" in link and "done(null)" in link assert "address.setError(TEXT.bad)" in link # 틀린 · 빈 주소는 모달 그대로 assert "pick.disabled = link.disabled = address.input.disabled = opts.readOnly;" in link assert "saveTemplate" not in link # 저장은 [저장]