Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
102 lines
3.8 KiB
Python
102 lines
3.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""311 좌측 패널 기본 접힘 · B07 첫 쪽 = 표지 (요구 204).
|
|
|
|
못박는 것
|
|
- 기본 접힘 = B09 「데이터 점검」 · 「공기 옵션」 / B07 「평면도」 · 「종단도」 · 「횡단도」 /
|
|
B06 「횡단 보기 설정」 / B05 「계획노선」 · 다른 컨테이너 기본값 그대로.
|
|
- 쪽 안에서 편 것은 다시 그려도 그대로 — B05 · B06 = 한 벌 패널이 칸을 한 번만 세움 · B07 = 다시 세울 때
|
|
옛 목록 접힘을 이어 받음 · B09 = 좌측 패널을 쪽 그릴 때 한 번만 세움.
|
|
- B07 처음 들어가면 표지 — 고른 장 기억(모듈 값 `reopenDrawingId` · `reopenCrossSheet`)이 있으면 그 장.
|
|
|
|
Node 헬퍼 `helper_311_panel_folded.cjs` 가 가짜 DOM 위에서 B05 · B06 · B07 패널을 돌림.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
ROOT = Path(HERE).parents[1]
|
|
|
|
|
|
def _read(rel: str) -> str:
|
|
return (ROOT / rel).read_text(encoding="utf-8")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_311_panel_folded.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_B05_B06_첫_그림_접힘(out):
|
|
assert out["profileFirst"] == {
|
|
"페이지 설정": True,
|
|
"계획노선": True,
|
|
"선택 포인트 상세 설정": False,
|
|
}
|
|
assert out["crossFirst"]["B06_View_Title"] is True
|
|
assert out["crossFirst"]["B06_Std_Title"] is True # 옛 기본 접힘 그대로
|
|
|
|
|
|
def test_B05_B06_편_뒤_다시_그림_유지(out):
|
|
assert out["crossFirst"]["계획노선"] is False # 편 것 → 보기 바꿔도 그대로
|
|
assert out["afterRedraw"]["계획노선"] is False
|
|
assert out["afterRedraw"]["B06_View_Title"] is False
|
|
assert out["sameRouteNode"] is True
|
|
|
|
|
|
def test_B07_첫_그림_접힘(out):
|
|
assert out["b07EntryFolded"] == [] # 들어올 때 = 라우터가 비운 그릇 → 기본값
|
|
assert out["b07First"] == {
|
|
"plan": True,
|
|
"longitudinal": True,
|
|
"cross": True,
|
|
"mass_haul": False,
|
|
}
|
|
|
|
|
|
def test_B07_다시_세워도_접힘_이어_받음(out):
|
|
assert out["b07Redraw"] == {
|
|
"plan": True,
|
|
"longitudinal": True,
|
|
"cross": False,
|
|
"mass_haul": True,
|
|
}
|
|
|
|
|
|
def test_B07_다시_세우기는_옛_목록을_기다리기_전에_읽음():
|
|
page = _read("B07_DesignDetail/B07_DesignDetail_UI_Page.ts")
|
|
body = page[page.index("export async function renderB07DesignDetail(") :]
|
|
assert body.index("const folded = foldedGroups(root);") < body.index("await ")
|
|
assert "crossLayoutSlot,\n folded,\n );" in body.replace("\r\n", "\n")
|
|
|
|
|
|
def test_B07_첫_장은_표지_기억_있으면_그_장():
|
|
page = _read("B07_DesignDetail/B07_DesignDetail_UI_Page.ts")
|
|
assert 'const cover = drawings.findIndex((item) => item.kind === "cover");' in page
|
|
assert "const first = reopen >= 0 ? reopen : Math.max(cover, 0);" in page
|
|
|
|
|
|
def test_B09_기본_접힘_좌측은_한_번만_세움():
|
|
shell = _read("B09_Estimation/B09_Estimation_UI_Shell.ts")
|
|
assert 'createPanelCard("데이터 점검", true)' in shell
|
|
assert 'createPanelCard("공기 옵션", true)' in _read(
|
|
"B09_Estimation/draft/B09_Draft_Schedule_Panel.ts"
|
|
)
|
|
# 다시 그림(show) 은 가운데 판만 바꿈 — 좌측 카드는 쪽 그릴 때 한 번
|
|
show = shell[shell.index("const show = (tab: TabId") : shell.index("const run = async (")]
|
|
assert "createPanelCard" not in show and "left." not in show
|
|
print_page = _read("B09_Estimation/draft/B09_Draft_Print_Page.ts")
|
|
assert 'createPanelCard("영역")' in print_page and 'createPanelCard("쪽 목록")' in print_page
|