"""191-1 B06 좌측 세부 컨테이너 누름 · 초점 = 그 구조물 형상 고름(값 바꿀 때와 같은 길). 화면 TS 를 흉내 DOM 에서 돌린 값(`helper_191_1_box_press_pick.cjs`). """ import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] HELPER = Path(__file__).parent / "helper_191_1_box_press_pick.cjs" NODE_MODULES = ROOT / "config" / "node_modules" pytestmark = pytest.mark.skipif(not NODE_MODULES.is_dir(), reason="프론트엔드 의존성 미설치") @pytest.fixture(scope="module") def out() -> dict: done = subprocess.run( # noqa: S603 — 고정 실행 파일 ["node", str(HELPER)], cwd=str(ROOT), capture_output=True, text=True, encoding="utf-8" ) assert done.returncode == 0, done.stderr return json.loads(done.stdout) def test_빈곳_누름_값바꿈과_같은_결과(out: dict) -> None: assert out["change"]["highlight"] == "inlet" assert out["pressBox"] == out["change"] # 고름 · 카드 · 넘김(스크롤) 차례까지 같음 def test_제목_누름_고름(out: dict) -> None: assert out["pressLegend"]["highlight"] == "inlet" assert ["select", 120, "inlet"] in out["pressLegend"]["log"] def test_입력칸_누름_고름_초점_되살림(out: dict) -> None: assert out["pressInput"] == { "highlight": "pipe", "repainted": True, "oldConnected": False, "focusSame": True, } def test_키보드_초점_고름_다른상자_바뀜(out: dict) -> None: assert out["tab"] == {"highlight": "extra1", "focusSame": True} assert out["switched"] == "extra0" assert out["switched2"] == "outlet" def test_누름_초점은_click_뒤(out: dict) -> None: assert out["focusBeforeClick"] == {"highlight": None, "connected": True} def test_단수칸_안고름_거듭누름_한번(out: dict) -> None: assert out["tiers"] is None assert out["twice"] == 2