"""345-4 노선 추천 → 좌측 새 칸 「노선 추천」(지운 「계획노선」 자리) — [노선 추천] · 현재 추천 · [초기화]. · 칸 요소는 `_Panel_Recommend` 가 만들고 편집기(`_RouteEdit_Initial`)가 밖에서 받아 건다 · 추천 창은 공용 모달 하나 · [적용] = 본문 평면에 되돌리기 한 칸(`restoreSnapshot(…, true)` → 이력 한 걸음) · 추천 창의 「지금 노선」은 본문 편집기 지금 노드 칸 생김새 · 차례는 `test_design_view_parity` · `test_311_panel_folded` 가 봄(화면 확인은 브레인). """ from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def _read(rel: str) -> str: return (ROOT / rel).read_text(encoding="utf-8") def test_칸_자리와_재료(): sections = _read("B05_Profile/B05_Profile_UI_Panel_Sections.ts") at = sections.index('id: "route-recommend"') block = sections[at : at + 300] assert 'title: "노선 추천"' in block and "order: 30," in block # 지운 계획노선 자리 assert 'part(ctx, "recommend").nodes' in block panel = _read("B05_Profile/B05_Profile_UI_Panel.ts") assert "const recommend = createRecommendPart();" in panel assert "Object.assign(shared.parts, { settings, recommend });" in panel view = _read("A00_Common/design/design_view_profile.ts") assert "recommend: panel.recommend," in view def test_편집기가_칸_요소를_밖에서_받음(): initial = _read("B05_Profile/B05_Profile_UI_RouteEdit_Initial.ts") assert "overlay" not in initial assert "const { recommendButton, resetButton, nowLine } = params.controls;" in initial assert "current: params.planned().map(([x, y]) => [x, y])," in initial # 지금 노선 main = _read("B05_Profile/B05_Profile_UI_RouteEdit.ts") assert "controls: options.recommend," in main assert "planned: () => planned," in main assert len(main.splitlines()) <= 700 def test_적용은_본문_평면에_되돌리기_한_칸(): main = _read("B05_Profile/B05_Profile_UI_RouteEdit.ts") assert "apply: (snapshot, message) => restoreSnapshot(snapshot, message, true)," in main restore = main[main.index("function restoreSnapshot(") :] restore = restore[: restore.index("\n }\n")] assert "applyEdit(message, record);" in restore apply_edit = main[main.index("function applyEdit(") :] assert "if (record) history?.commit(snapshotNow());" in apply_edit[:600] initial = _read("B05_Profile/B05_Profile_UI_RouteEdit_Initial.ts") on_apply = initial[initial.index("onApply: (picked) => {") :] assert on_apply[:500].count("params.apply(") == 1 def test_추천_창은_공용_모달_하나(): rec = _read("B05_Profile/B05_Profile_UI_RouteEdit_Recommend.ts") assert rec.count("openModal(") == 1 # 뒤 판(평면 · 종단도) 단축키가 창 안 Ctrl+Z 를 받지 않게 — 창 막에서 끊음 assert '?.closest(".ui-modal__backdrop")' in rec and "key.stopPropagation();" in rec