Files
Aislo/resources/tester/test_ui_side_panels.py
T
eomsangdonandClaude Opus 5.5 cbe0c17505 feat(ui): 47-3 공용 오른쪽 접는 패널 부품 — 패널 여럿 나란히 · 하나만 열림 · 폭 공유
- createSidePanels({ prefKey, panels: [{ id, title, body }] }) · 본문과 함께 .ui-side-panels-row 칸에 [본문, root]
- 접힌 패널 = 제목 세로 글 띠(누르면 폄) · 편 패널 = 머리(제목 · 접기 ▸) + 몸 · 모두 접힘 됨
- 왼쪽 경계 끌기 · 화살표 키로 폭 · 열린 패널 · 폭은 취향 키 aislo:pref:{prefKey}
- 폭 자르기 시험(test_ui_side_panels)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPJGtfXo6GMbcpiboQC4uK
2026-10-05 13:36:25 +09:00

45 lines
1.6 KiB
Python

"""공용 오른쪽 접는 패널(`ui_template_side_panels.ts`) 시험 — 폭 자르기 · 줄 수.
접기 · 펴기 · 기억은 화면 시나리오(`ui_checks/47-3_로직상세_오른쪽패널.js`)로 봄.
"""
from __future__ import annotations
import json
import re
import shutil
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
PART = ROOT / "ui_template" / "ui_template_side_panels.ts"
def test_700줄을_넘지_않음():
for path in (PART, PART.with_suffix(".css")):
assert len(path.read_text(encoding="utf-8").splitlines()) <= 700, path.name
@pytest.mark.skipif(shutil.which("node") is None, reason="node 가 없음")
def test_폭_자르기():
"""`clampSideWidth` — 가장 작게 min · 가장 크게 화면 85% · 화면이 좁아도 min."""
found = re.search(
r"^export function clampSideWidth[\s\S]*?^}", PART.read_text(encoding="utf-8"), re.M
)
assert found, "clampSideWidth 를 못 찾음"
script = (
found.group(0).replace("export ", "")
+ "\nconsole.log(JSON.stringify(JSON.parse(process.argv[1])"
+ ".map(([p, m, v]) => clampSideWidth(p, m, v))));"
)
cases = [[100, 280, 1600], [500.4, 280, 1600], [5000, 280, 1600], [500, 280, 200]]
result = subprocess.run(
["node", "--experimental-strip-types", "--no-warnings",
"--input-type=module-typescript", "-e", script, json.dumps(cases)],
capture_output=True, text=True, encoding="utf-8", timeout=60,
) # fmt: skip
assert result.returncode == 0, result.stderr
assert json.loads(result.stdout) == [280, 500, 1360, 280]