- B09 데이터 점검 → 내역 점검 · 공기 옵션 → 공사기간 조건 · 박스보기/호표보기 → 카드 보기/표 보기 · 하이퍼링크/팝업 → 탭 이동/곁 창 · 굳힌 단가 → 이 공사 단가 책 · 산식/요율 출처 → 계산식/요율 근거 · 빈 줄 → 금액 빈 줄 · 단가연결 칸 램프 → 단가연결 칸 ● · 새 산근 → 새 단가산출(산근) · 연결 없음 → 일위대가 없음 - 단가연결 창 종류 일위대가 사전조합 → 일위대가(자료집) · 일위대가 호표 → 이 공사 일위대가 · 단가산출 호표 → 이 공사 단가산출 · 대가N/산근 N호표 → 일위대가 N호/단가산출 N호 · 구조물 조합 줄 번호(SS…) 숨김 · 넣을 값 창 제목 번호 → 알림 글 끝 - B08 조합 사본 · 조합 연결 · 노랑 램프 → 구조물 조합 · 구조물 조합 고르기 · 노랑 ●(locale_b4 B08_Quantity_* 글만 · 한시 브레인 승인) - ☰ 서랍 · 진행 판 끝 「내 자료집(일위대가 · 구조물 조합)」 = M02 일위대가조합 개인 층(떠남 물음 뒤) - 낡은 시험 글 고침(새 낱말): 143-1 · 157-2 · 182 · 203-1 · 204-2 · 304 · 311 · 701-3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
4.6 KiB
Python
104 lines
4.6 KiB
Python
"""304-1 B09 박스보기 · 호표보기 = 좌측 하단 한 설정(묶음 탭 셋 함께).
|
|
|
|
- 한 값(`b09-group-view` · pref global)이 dg · machine_blocks · sg 셋에 함께 · 기본 = 박스(카드)
|
|
- 옛 탭별 값(`{탭: 보기}`) = 첫 읽기에 한 값으로(dg · 없으면 다른 탭 · 없으면 기본) 옮겨 적음
|
|
- 보조 탭 줄 보기 토글 걷음 · 가로 열 수 단추(박스 보기)는 그대로
|
|
- 좌측 하단 스위치 [박스보기|호표보기] 누름 = 값 바꿈 · 다시 그림 부름
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from resources.tester.helper_b09_group_cards import COMMON, GRID, GROUPS, RAW, TABS, run # noqa: E402
|
|
|
|
LABOR = "B09_Estimation/B09_Estimation_UI_Tabs_Labor.ts"
|
|
DOCK = "B09_Estimation/B09_Estimation_UI_Dock.ts"
|
|
DG = {"id": "DG1", "no": 1, "name": "찰쌓기", "unit": "m2", "lines": [], "sum": 0}
|
|
SPEC = (
|
|
"\nconst spec = buildDaegaBlocks({ sheets: { daega_blocks: ["
|
|
+ json.dumps(DG, ensure_ascii=False)
|
|
+ "] } });"
|
|
"\nconst tools = [];"
|
|
"\nconst draw = (tab) => renderGroupPanel({ tab, spec, hint: null, goto: () => {},"
|
|
" setTools: (t) => tools.push(...t),"
|
|
" makeTable: () => ({ root: document.createElement('table'), focusRow: () => {} }) })[0];"
|
|
"\nconst kinds = () => ['dg', 'machine_blocks', 'sg'].map((t) => draw(t).tagName);"
|
|
)
|
|
|
|
|
|
def test_한_설정_셋_탭_함께():
|
|
out = run(
|
|
[COMMON, TABS, GRID, LABOR, GROUPS],
|
|
SPEC + "\nconst a = kinds();"
|
|
"\nchooseGroupView('table');"
|
|
"\nconst b = kinds();"
|
|
"\nconsole.log(JSON.stringify({ a, b, kept: Object.fromEntries(kept),"
|
|
" toggles: tools.filter((e) => e.dataset.b09GroupView).length,"
|
|
" cols: tools.flatMap((e) => e.all('[data-group-cols]')).length }));",
|
|
RAW,
|
|
)
|
|
assert out["a"] == ["DIV"] * 3 # 기본 = 박스
|
|
assert out["b"] == ["TABLE"] * 3 # 한 값이 셋 탭 함께
|
|
assert json.loads(out["kept"]["b09-group-view"]) == "table"
|
|
assert out["toggles"] == 0 # 탭 줄 보기 토글 없음
|
|
assert out["cols"] == 4 * 3 # 박스 보기 가로 열 수 단추 = 탭 줄 그대로
|
|
|
|
|
|
def test_옛_탭별_값_첫_읽기에_한_값으로():
|
|
cases = [
|
|
({"dg": "table", "sg": "cards"}, "table"),
|
|
({"dg": "cards", "sg": "table"}, "cards"), # dg 먼저
|
|
({"sg": "table"}, "table"), # dg 없으면 다른 탭
|
|
({"machine_blocks": "table", "sg": "cards"}, "table"),
|
|
({}, "cards"), # 없으면 기본
|
|
]
|
|
for old, want in cases:
|
|
out = run(
|
|
[COMMON, TABS, GRID, LABOR, GROUPS],
|
|
"\nkept.set('b09-group-view', "
|
|
+ json.dumps(json.dumps(old))
|
|
+ ");"
|
|
+ SPEC
|
|
+ "\nconst got = kinds();"
|
|
"\nconsole.log(JSON.stringify({ got, kept: Object.fromEntries(kept) }));",
|
|
RAW,
|
|
)
|
|
assert out["got"] == ["TABLE" if want == "table" else "DIV"] * 3, old
|
|
assert json.loads(out["kept"]["b09-group-view"]) == want, old # 옮겨 적음
|
|
|
|
|
|
def test_좌측_스위치_누름():
|
|
out = run(
|
|
[COMMON, TABS, GROUPS, DOCK],
|
|
"\nlet redraws = 0;"
|
|
"\nconst dock = createDock([document.createElement('button')], () => redraws++);"
|
|
"\nconst row = dock.children[0];"
|
|
"\nconst pressed = () => row.children.map((b) => b.attrs['aria-checked']);"
|
|
"\nconst labels = row.children.map((b) => b.textContent);"
|
|
"\nconst a = pressed();"
|
|
"\nrow.children[0].click();" # 이미 박스 = 그대로
|
|
"\nconst b = [redraws, pressed()];"
|
|
"\nrow.children[1].click();"
|
|
"\nconsole.log(JSON.stringify({ name: row.dataset.b09Switch, labels, a, b, c: [redraws, pressed()],"
|
|
" view: groupView(), kept: Object.fromEntries(kept) }));",
|
|
)
|
|
assert out["name"] == "view" and out["labels"] == ["카드 보기", "표 보기"]
|
|
assert out["a"] == ["true", "false"] # 기본 = 박스보기
|
|
assert out["b"] == [0, ["true", "false"]]
|
|
assert out["c"] == [1, ["false", "true"]] and out["view"] == "table"
|
|
assert json.loads(out["kept"]["b09-group-view"]) == "table" # [저장] 없이 pref
|
|
|
|
|
|
def test_잇기():
|
|
groups = (ROOT / GROUPS).read_text("utf-8")
|
|
assert "toggle" not in groups and "redraw" not in groups and "createButton" not in groups
|
|
shell = (ROOT / "B09_Estimation/B09_Estimation_UI_Shell.ts").read_text("utf-8")
|
|
assert "createDock([save, reset], () => isGroupTab(current) && show(current))" in shell
|
|
state = (ROOT / "A00_Common/b_page_state.ts").read_text("utf-8")
|
|
assert '"b09-group-view": { bucket: "pref", scope: "global" },' in state
|