Files
Aislo/resources/tester/test_345_3_route_body.py
T
eomsangdonandClaude Opus 5.5 d985c24f5c feat(종단보기): 345-3 노선 편집 → 종단 보기 가운데 위 본문(페이지 수명) · 종단도 판 흐름 배치 · [노선 반영] 뒤 새로고침 없이 다시 세움 · Ctrl+Z · Y 는 마지막에 만진 판 · 「계획노선」 칸 · 편집 단추 지움
- mountRouteEditor(parent, host, …) — 덮개 · 전체 화면 · 닫기 걷음 · 이력 · 키 듣기 = host 보임 · 숨김 · 떠남 · 칸 크기 = ResizeObserver
- [취소] → [반영 전으로](이력 처음으로 · 되돌리기로 다시 살림) · [확인] → [노선 반영] · 대기 막 = 화면 전체(노선 재탐색)
- [노선 반영] 끝 = 초안 · 결과 · 옛 노선 · 종단면 캐시 비움 → remountRoute(location.reload 없앰)
- R 라벨 = 칸 안 절대 위치 · 오른쪽 횡단 미리보기 = 접는 칸 · [3D] 단추 = 평면 머리 도구줄
- 새 _RouteEdit_UndoOwner(누른 판 기억) · 종단도 Ctrl+Z 줄이 물음
- 시험: test_345_3_route_body 5 · 칸 · 겉틀 시험 고쳐 씀 · 관련 411 통과(옛 3 실패 그대로) · typecheck 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
2026-10-16 11:23:27 +09:00

94 lines
3.8 KiB
Python

"""345-3 노선 편집 → 종단 보기 가운데 위 본문 — Ctrl+Z · Y 는 마지막에 만진 판 하나 · 종단도 판 흐름 배치 ·
왼쪽 「계획노선」 칸 · 편집 단추 지움 · [노선 반영] 뒤 새로고침 없이 다시 세움.
Ctrl+Z 몫은 Node 헬퍼 `helper_345_3_undo_owner.cjs` 가 진짜 `_RouteEdit_History` · `_UndoOwner` 로 돌림 ·
배선 · CSS 는 글로 봄(화면 확인은 브레인).
"""
from __future__ import annotations
import json
import re
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
def _read(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)
@pytest.fixture(scope="module")
def out() -> dict:
run = subprocess.run(
["node", str(HERE / "helper_345_3_undo_owner.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
check=True,
)
return json.loads(run.stdout)
def test_Ctrl_Z_는_마지막에_만진_판_하나(out):
assert out["beforeListen"] == {"plan": [], "profile": ["undo"], "owner": "profile"}
assert out["untouched"]["plan"] == [] and out["untouched"]["profile"] == ["undo", "undo"]
# 평면을 누른 뒤 — 평면만(종단도 안 움직임)
assert out["afterPlanPress"]["plan"] == ["undo", "redo"]
assert out["afterPlanPress"]["profile"] == ["undo", "undo"]
# 종단 판을 누른 뒤 — 종단도만
assert out["afterProfilePress"]["plan"] == ["undo", "redo"]
assert out["afterProfilePress"]["profile"] == ["undo", "undo", "undo"]
# 보기 숨김(평면 안 들음) — 평면을 마지막에 만졌어도 종단도가 받음
assert out["hidden"]["owner"] == "profile"
assert out["hidden"]["profile"] == ["undo", "undo", "undo", "undo"]
# 다시 보임 — 평면 · Shift+Z = 다시하기
assert out["shown"]["plan"] == ["undo", "redo", "redo"]
assert out["shown"]["profile"] == out["hidden"]["profile"]
# 떠남 — 평면 단축키 뗌
assert out["disposed"]["plan"] == out["shown"]["plan"]
def test_종단도_Ctrl_Z_줄이_평면을_묻는다():
tools = _read("B05_Profile/B05_Profile_UI_Profile_Panel_Tools.ts")
at = tools.index('if (isCtrlKey(event, "z")) {')
assert 'if (undoOwner() === "plan") return;' in tools[at : at + 160]
history = _read("B05_Profile/B05_Profile_UI_RouteEdit_History.ts")
assert 'undoOwner() !== "plan"' in history
assert (
'window.addEventListener("keydown", onKey);\n\n return' not in history
) # 만들 때 안 붙음
def test_편집기는_본문_페이지_수명():
view = _read("A00_Common/design/design_view_profile.ts")
assert "mountRouteEditor(mainContent, host, activeProjectId, rebuildAfterReplan," in view
assert "tools: [view3d.modal.button]," in view
assert "openRouteEditModal" not in view and "location.reload()" not in view
assert len(view.splitlines()) <= 700
def test_종단도_판은_두_보기_모두_흐름():
css = _read("A00_Common/design/design_page.css")
rule = _block(css, ".design-page__main > .design-page__profile > .b05-route-profile")
assert "position: relative;" in rule and "flex: none;" in rule
assert '[data-view="cross"] > .design-page__profile > .b05-route-profile' not in css
def test_계획노선_칸_편집_단추_지움():
sections = _read("B05_Profile/B05_Profile_UI_Panel_Sections.ts")
assert '"planned-route"' not in sections and "plannedRouteButton" not in sections
panel = _read("B05_Profile/B05_Profile_UI_Panel.ts")
assert "onEditPlannedRoute" not in panel and "createRoutePart" not in panel
assert not (ROOT / "B05_Profile/B05_Profile_UI_Panel_Route.ts").exists()