# -*- coding: utf-8 -*- """요구 280-2 · PLAN 481-1 — 좌측 아래 [?] [<] [>] 페이지 이동. ① 줄 차례 = [?] [<] [>] + 그 페이지 단추 · 다섯 주소만(b03 · b04 · b09-print · m01 · m02 = [?] 만) · B09 [>] 흐림 ② [<] [>] = 이웃 단계 단추 누름(`onStepClick` 한 길) · 막힌 단계 = 누르지 않고 그 단추 title 알림 ③ B05 ↔ B06 = 같은 페이지 주소만(다시 안 실음) · B05 · B06 도크 = [초기화] [저장] [확정] 셋 """ 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] FIVE = ("b05-profile", "b06-section", "b07-design-detail", "b08-quantity", "b09-estimation") OTHERS = ("b03-file-input", "b04-preprocess", "b09-print", "m01-master-data", "m02-master-template") @pytest.fixture(scope="module") def results(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_280_2_step_nav.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) @pytest.mark.parametrize("shape", ["helpRow", "plain"]) def test_다섯_주소만_물음_앞뒤_차례(results, shape): for route in FIVE: assert results["rows"][route][shape]["labels"] == ["?", "<", ">", "저장"], route for route in OTHERS: assert results["rows"][route][shape]["labels"] == ["?", "저장"], route def test_B09_다음만_흐림(results): for route in FIVE: expected = [False, False, route == "b09-estimation", False] assert results["rows"][route]["helpRow"]["disabled"] == expected, route def test_앞뒤는_이웃_단계_누름(results): nav = results["nav"] assert nav["b05Prev"] == {"calls": ["1:b04-preprocess"], "toasts": []} assert nav["b05Next"] == {"calls": ["3:b06-section"], "toasts": []} # B05 → B06 은 같은 페이지 — setActiveStep 으로 켜진 칸이 바뀐 뒤 이웃 assert nav["b06Prev"] == {"calls": ["2:b05-profile"], "toasts": []} assert nav["b06Next"] == {"calls": ["4:b07-design-detail"], "toasts": []} assert nav["b09Prev"] == {"calls": ["5:b08-quantity"], "toasts": []} assert nav["b09Next"] == {"calls": [], "toasts": []} def test_막힌_단계는_알림만(results): nav = results["nav"] assert nav["blockedNext"] == {"calls": [], "toasts": ["WF_State_NotStarted"]} assert nav["userPrev"] == {"calls": [], "toasts": ["시스템 관리자 전용 단계입니다."]} def test_B05_B06_사이는_주소만_다시_안_실음(): page = (ROOT / "A00_Common" / "design" / "design_page.ts").read_text(encoding="utf-8") assert "if (designViewOf(route)) navigateTo(route);" in page dock = (ROOT / "A00_Common" / "design" / "design_dock.ts").read_text(encoding="utf-8") shared = (ROOT / "A00_Common" / "design" / "design_shared.ts").read_text(encoding="utf-8") for text in (dock, shared): assert "switchView" not in text assert "row.append(resetButton, saveButton, confirmButton);" in dock locale = (ROOT / "ui_template" / "ui_template_locale_b2.ts").read_text(encoding="utf-8") assert "Design_Btn_ToCross" not in locale and "Design_Btn_ToProfile" not in locale