28 lines
1.2 KiB
Python
28 lines
1.2 KiB
Python
"""560-4 D 단계 이동 = 저장 뒤 이동 지킴 시험 — 서버 · 화면 없이 소스만 본다.
|
|
단계 아이콘 · [<] [>] · 머리 메뉴 · 뒤로가 한 함수(beforeLeave)를 거치고 · D02 첫 불러오기 실패에도 지도를 세움."""
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def _src(path: str) -> str:
|
|
return (ROOT / path).read_text(encoding="utf-8")
|
|
|
|
|
|
def test_group_step_waits_before_leave():
|
|
ts = _src("A00_Common/group_workflow.ts")
|
|
assert "beforeLeave?: () => Promise<boolean>" in ts
|
|
assert "setLeaveGuard(" in ts # 머리 메뉴 · 뒤로
|
|
assert "leave().then((ok) => ok && navigateTo(" in ts # 단계 아이콘 · [<] [>]
|
|
|
|
|
|
def test_d02_leave_saves_and_builds_map_on_fail():
|
|
ts = _src("D02_PlanBase/D02_PlanBase_UI_Page.ts")
|
|
assert "beforeLeave:" in ts and "ui-step-nav" not in ts # 따로 듣개 없음
|
|
tail = ts[ts.rindex(" try {") :]
|
|
# 불러오기 catch 뒤에 paint() — 실패해도 지도 · 표를 세움
|
|
assert re.search(r"\} catch \(error\) \{[^}]*\}\s*active = firstEmpty\(\);\s*paint\(\);", tail)
|
|
assert "sameBase" in ts # 옛 캐시는 그때 서버 값이 지금과 같을 때만
|