# -*- coding: utf-8 -*- """153-1 B07 횡단 장 배치 칸. 못박는 것 - 배치 칸 자리 = 좌측 「횡단도」 묶음 맨 아래(한 번만) — 정보 칸을 다시 그려도 안 사라짐. - 공용 입력칸(ui-field__label · ui-input--sm · 1~10) 둘 + 작은 ghost 단추 [이 장] [모든 장]. - 장이 아니면 [이 장] 꺼짐 · [모든 장]은 됨 · 범위 밖 값 = 알림만. Node 헬퍼 `helper_153_b07_cross_layout.cjs` 가 화면 그릇 흉내로 돌림. 화면은 사용자 확인. """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope="module") def out(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_153_b07_cross_layout.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_횡단도_묶음_맨_아래(out): assert out["slotLast"] is True assert out["slotCount"] == 1 def test_공용_입력칸과_작은_단추(out): sheet = out["sheet"] assert sheet["boxClass"] == "b07-cross-layout" assert sheet["labels"] == ["배치 열", "행"] assert [i["value"] for i in sheet["inputs"]] == ["3", "4"] for field in sheet["inputs"]: assert field["type"] == "number" and field["min"] == "1" and field["max"] == "10" assert "ui-input--sm" in field["cls"] assert [b["text"] for b in sheet["buttons"]] == ["이 장", "모든 장"] for button in sheet["buttons"]: assert button["cls"] == "ui-btn ui-btn--ghost ui-btn--sm" and not button["disabled"] def test_이_장_모든_장_누름(out): clicks = out["sheetClicks"] assert clicks["applied"] == [[2, 5]] assert clicks["defaults"] == [[2, 5]] assert [t[0] for t in clicks["toasts"]] == ["error"] # 11 = 범위 밖 def test_장_아니면_이_장_꺼짐(out): not_sheet = out["notSheet"] assert not_sheet["disabled"] == [True, False] assert not_sheet["defaults"] == [[4, 4]] assert not_sheet["values"] == ["4", "4"] def test_표_배율_칸(out): scale = out["scale"] assert scale["labels"] == ["배치 열", "행", "표 배율"] assert scale["input"] == {"value": "1", "min": "0.5", "max": "2", "step": "0.1"} assert scale["buttons"] == ["이 장", "모든 장", "배율 적용"] assert scale["applied"] == [1.5] assert scale["toasts"] == ["error"] # 2.5 = 범위 밖