Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPJGtfXo6GMbcpiboQC4uK
104 lines
3.7 KiB
Python
104 lines
3.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""130-1 B07 [평면도 관리] 모달.
|
|
|
|
못박는 것
|
|
- 좌측 「평면도」 = 장 단추 + [평면도 관리] 하나 · 종류 폼 · 대피소 칸 · × 없음.
|
|
- 단추 → 공용 모달(큰 창) · 안에 종류 목록 · 종류 폼 · 대피소 · 사토장 자리 · 장 목록 · 첫 장 미리보기(보기 전용).
|
|
- 종류 추가 · 업데이트(축척 포함) · 지우기 = 지금 서버 길 · 고칠 때마다 모달 안을 다시 받음.
|
|
- 미리보기 장 바꾸기 · 확정이면 [확정 풀기](invalidate) · 닫으면 changed=True · [CAD 에서 열기] = 그 장 id.
|
|
|
|
Node 헬퍼 `helper_130_b07_plan_manage.cjs` 가 화면 그릇 흉내로 돌림. 화면은 사용자 확인.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_130_b07_plan_manage.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_좌측은_장_목록과_관리_단추만(out):
|
|
left = out["left"]
|
|
assert left["manage"] == 1
|
|
assert left["sheetButtons"] == ["plan_k_terrain", "plan_k_terrain_2", "plan_k_route"]
|
|
assert left["formFields"] == 0 # 드롭다운 · 이름 칸 · 체크박스 없음
|
|
assert left["remove"] == 0
|
|
assert "대피소" not in left["texts"] and "종류 추가" not in left["texts"]
|
|
|
|
|
|
def test_단추를_누르면_모달(out):
|
|
opened = out["open"]
|
|
assert opened["title"] == "평면도 관리"
|
|
assert opened["dialogClass"] == "b07-plan-manage"
|
|
assert opened["kinds"] == ["k_terrain", "k_route"]
|
|
assert opened["sheets"] == ["plan_k_terrain", "plan_k_terrain_2", "plan_k_route"]
|
|
assert opened["hasKindForm"] and opened["hasMarks"]
|
|
|
|
|
|
def test_첫_장_미리보기는_보기_전용(out):
|
|
assert out["open"]["preview"] == "plan_k_terrain"
|
|
extra = out["open"]["extra"]
|
|
assert extra["readOnly"] is True and extra["viewOnly"] is True
|
|
assert extra["recoveryScope"] == "b07-plan-preview" # 본 CAD 자동백업 칸과 안 겹침
|
|
|
|
|
|
def test_종류_추가(out):
|
|
assert out["add"]["call"] == ["add", "sub6임시", [], "plan", 1200]
|
|
assert out["add"]["kinds"][-1] == "k_new"
|
|
assert out["add"]["sheets"][-1] == "plan_k_new" # 장 목록도 다시 받음
|
|
|
|
|
|
def test_종류_업데이트(out):
|
|
assert out["updateLabel"] == "업데이트"
|
|
assert out["update"]["call"] == ["update", "k_new", "sub6임시2", [], 1000]
|
|
assert out["update"]["rowText"].startswith("sub6임시2 · 1장")
|
|
|
|
|
|
def test_종류_지우기(out):
|
|
assert out["remove"]["call"] == ["delete", "k_new"]
|
|
assert out["remove"]["confirms"] == 1
|
|
assert out["remove"]["kinds"] == ["k_terrain", "k_route"]
|
|
|
|
|
|
def test_미리보기_장_바꾸기(out):
|
|
s2 = out["sheet2"]
|
|
assert s2["preview"] == "plan_k_terrain_2"
|
|
assert s2["active"] == ["plan_k_terrain_2"]
|
|
assert "확정 전" in s2["head"] and "확정 풀기" not in s2["head"]
|
|
|
|
|
|
def test_확정이면_확정_풀기(out):
|
|
assert "확정 풀기" in out["routeHead"]
|
|
rel = out["release"]
|
|
assert rel["call"] == ["invalidate", "plan_k_route"]
|
|
assert "확정 풀기" not in rel["head"]
|
|
assert rel["preview"] == "plan_k_route" # 보던 장 그대로
|
|
|
|
|
|
def test_닫으면_좌측_다시_읽기_신호(out):
|
|
assert out["close"] == {"closes": [[True, None]], "destroyed": True, "open": False}
|
|
|
|
|
|
def test_CAD_에서_열기는_그_장(out):
|
|
assert out["openInCad"] == {
|
|
"closes": [[False, "plan_k_route"]],
|
|
"destroyed": True,
|
|
"open": False,
|
|
}
|
|
assert out["toasts"] == []
|