Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
35 lines
1.7 KiB
Python
35 lines
1.7 KiB
Python
"""161-1 B08 구조물도 모달 — 일위대가 카드(보기 전용) · 사본 일위대가 읽기 · 카드 차례 도면 · 일위대가 · 면적산출."""
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
DRAWING = Path("B08_Quantity/B08_Quantity_UI_Drawing.ts").read_text(encoding="utf-8")
|
|
CARDS = Path("M02_MasterTemplete/M02_MasterTemplete_ItemCards.ts").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_labor_handle_passed():
|
|
# createItemCards 에 labor 손잡이 — 없으면 카드 자체를 안 만듦(ItemCards `opts.labor ?`)
|
|
call = DRAWING[DRAWING.index("createItemCards({") :]
|
|
call = call[: call.index("});")]
|
|
assert 'labor: () => openEdit(copy, name, "inputs", load)' in call # 163-3 넣을 값만
|
|
assert "editable: () => true" in call
|
|
assert "const laborCard = opts.labor" in CARDS
|
|
|
|
|
|
def test_source_reads_copy_labor():
|
|
# 142-1 고르기 모달과 같은 길 — 사본 일위대가 · 입력값 · 고른자재 → withCopyValues · 셈도 사본
|
|
src = DRAWING[DRAWING.index("function sourceOf") : DRAWING.index("function comboSection")]
|
|
assert "labor: {" in src
|
|
for part in ('"일위대가"', '"입력값"', '"고른자재"'):
|
|
assert f"items.read(folder, {part})" in src, part
|
|
assert "withCopyValues(labor.줄, values, picks)" in src
|
|
assert "items.calcLabor(folder)" in src
|
|
assert re.search(r"if \(!labor\?\.줄\) throw", src) # 없으면 카드 「없음」
|
|
assert "src.labor ? src.labor.read(at)" in CARDS
|
|
|
|
|
|
def test_card_order_and_heads():
|
|
assert "const cards: Card[] = [info, ...(laborCard ? [laborCard] : []), ...sheets]" in CARDS
|
|
assert 'drawingInfo: "도면 정보"' in CARDS
|
|
assert 'labor: "일위대가"' in CARDS and 'area: "면적산출"' in CARDS
|