Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QND7Co43B24zK2P937rdxt
111 lines
5.2 KiB
Python
111 lines
5.2 KiB
Python
"""공용 모달 머리 단추 · 큰 창 · M02 수량산출 창(PLAN 147) — 소스 검사 · 화면 판정은 사용자.
|
||
|
||
· 147-1 곁값 `actions`(머리 [닫기] 바로 왼쪽 · 넘긴 창만) · `wide`(96vw × 94vh · 몸만 스크롤)
|
||
· 147-2 연결창 단추 넷 → 머리 · 큰 창 · 글 묻는 창 [확인] 머리 · [취소] 없음
|
||
· 147-3 M02 입력 · 수량산출 · 참조 창 — 아래 단추 줄 없음 · [확인] 머리 · 읽기만이면 없음
|
||
· 147-4 「손 입력」 → 「수기 입력」 · 짧은 글 「손」 → 「수기」 · [면적산출에서 잇기] · goArea 없음
|
||
· 147-5 수량산출 시트 위 「고른 칸 … [확인]」 · 「면적산출 시트 — …」 없음 · [연결 풀기] 누르면 꺼짐
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[2]
|
||
|
||
|
||
def _text(rel: str) -> str:
|
||
return (ROOT / rel).read_text(encoding="utf-8")
|
||
|
||
|
||
def _block(css: str, selector: str) -> str:
|
||
found = re.search(rf"^{re.escape(selector)} \{{([^}}]*)\}}", css, re.M)
|
||
assert found, selector
|
||
return found.group(1)
|
||
|
||
|
||
def test_147_1_곁값_actions_wide():
|
||
ts = _text("ui_template/ui_template_modal.ts")
|
||
assert "actions?: HTMLElement[];" in ts
|
||
assert "wide?: boolean;" in ts
|
||
# 몸에서 만든 단추도 넣게 mount 셋째 인자 = 머리 자리
|
||
assert "opts.mount(body, close, actions);" in ts
|
||
# 단추가 있을 때만 [닫기] 바로 앞에 — 없으면 지금 꼴(h3 · [닫기])
|
||
assert "if (actions.childElementCount) closeButton.before(actions);" in ts
|
||
assert 'children: [el("h3", { text: opts.title }), closeButton]' in ts
|
||
assert '"ui-modal--wide "' in ts
|
||
|
||
|
||
def test_147_1_머리_자리_큰_창_css():
|
||
css = _text("ui_template/ui_template_modal.css")
|
||
assert "margin-right: auto;" in _block(css, ".ui-modal__top > h3")
|
||
assert "justify-content: space-between;" in _block(css, ".ui-modal__top")
|
||
wide = _block(css, ".ui-modal.ui-modal--wide")
|
||
for rule in ("width: 96vw;", "height: 94vh;", "--modal-max: 94vh;", "overflow: hidden;"):
|
||
assert rule in wide, rule
|
||
body = _block(css, ".ui-modal--wide > .ui-modal__body")
|
||
assert "overflow: auto;" in body and "min-height: 0;" in body
|
||
|
||
|
||
def test_147_2_연결창_머리_단추_큰_창():
|
||
ts = _text("ui_template/ui_template_item_picker.ts")
|
||
assert "children: [copyButton, manageButton, clearButton, applyButton]," in ts
|
||
assert "actions: [headButtons]," in ts and "wide: true," in ts
|
||
# 편집 화면 = 머리 단추도 숨김(편집 중 [적용] 막음) · 돌아오면 다시
|
||
assert "headButtons.hidden = true;" in ts and "headButtons.hidden = false;" in ts
|
||
# 안내 글(구조물 [저장]) 은 아래 남김
|
||
assert "ui-item-picker__saveline" in ts
|
||
css = _text("ui_template/ui_template_item_picker.css")
|
||
assert ".ui-item-picker .ui-modal__actions[hidden]" in css
|
||
assert "width: min(1320px, 96vw);" not in css
|
||
|
||
|
||
def test_147_2_글_묻는_창_확인만_머리():
|
||
ask = _text("ui_template/ui_template_item_picker_ask.ts")
|
||
assert "head.append(createButton({ label: opts.okLabel" in ask
|
||
assert "cancelLabel" not in ask
|
||
for rel in (
|
||
"ui_template/ui_template_item_picker.ts",
|
||
"ui_template/ui_template_item_picker_detail.ts",
|
||
):
|
||
assert "cancelLabel" not in _text(rel), rel
|
||
|
||
|
||
def test_147_3_m02_창_셋_머리_확인():
|
||
m02 = "M02_MasterTemplete/M02_MasterTemplete_"
|
||
for name in ("Labor_Input", "Labor_QtyModal", "Labor_RefEdit"):
|
||
ts = _text(f"{m02}{name}.ts")
|
||
assert "m02-labin__foot" not in ts, name
|
||
assert "mount: (body, " in ts and ", head) => {" in ts, name
|
||
# 읽기만 = 머리 [닫기]만
|
||
assert "if (!opt.readOnly)" in ts and "head.append(" in ts, name
|
||
assert "In_Cancel" not in _text(f"{m02}Labor_Text.ts")
|
||
assert ".m02-labin__foot" not in _text(f"{m02}Labor.css")
|
||
|
||
|
||
def test_147_4_수기_입력_잇기_없음():
|
||
m02 = ROOT / "M02_MasterTemplete"
|
||
text = _text("M02_MasterTemplete/M02_MasterTemplete_Labor_Text.ts")
|
||
assert 'In_QtyHand: ["수기 입력", "Manual"],' in text
|
||
assert 'Labor_Hand: ["수기", "Manual"],' in text
|
||
assert "In_QtyGoArea" not in text
|
||
assert "손 입력" not in _text("M02_MasterTemplete/M02_MasterTemplete_CardHelp.ts")
|
||
for path in m02.glob("*.ts"):
|
||
src = path.read_text(encoding="utf-8")
|
||
assert "goArea" not in src and "GoArea" not in src, path.name
|
||
|
||
|
||
def test_147_5_시트_위_글_없음_풀기_꺼짐():
|
||
qty = _text("M02_MasterTemplete/M02_MasterTemplete_Labor_QtyModal.ts")
|
||
text = _text("M02_MasterTemplete/M02_MasterTemplete_Labor_Text.ts")
|
||
for key in ("Labor_SheetHint", "Labor_CellPending", "Labor_UnlinkPending"):
|
||
assert key not in qty and key not in text, key
|
||
assert "data-labor-qty-state" not in qty and "m02-cellpick__hint" not in qty
|
||
assert ".m02-cellpick__hint" not in _text("M02_MasterTemplete/M02_MasterTemplete_AreaPanel.css")
|
||
# [연결 풀기] = 누르면 꺼짐 · 칸을 고르면 다시 켜짐 · 고름 상태는 [확인] 때 씀
|
||
assert 'pending = { kind: "unlink" };' in qty
|
||
assert "if (unlink) unlink.disabled = true;" in qty
|
||
assert "if (unlink) unlink.disabled = false;" in qty
|
||
assert "...(opt.handOnly ? [] : [host])," in qty
|