Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JywHxQuWPk6UYXTebyrBoU
93 lines
3.3 KiB
Python
93 lines
3.3 KiB
Python
"""PLAN 150-4 — B06 [상세] 수량표 칸 누름 = 그림 복제 안 그 항목 강조.
|
|
|
|
짝: `B06_Section/B06_Section_UI_Cross_Detail_Pick.ts`(짝 표 · 구역) · `_UI_Cross_Detail.ts`(칸 키 · 누름).
|
|
실제 TS 를 `helper_150_detail_pick.cjs` 가 Node 로 돌린다.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Table import QUANTITY_VALUE_KEYS
|
|
|
|
HERE = os.path.dirname(__file__)
|
|
ROOT = os.path.join(HERE, "..", "..")
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
|
|
reason="프론트엔드 의존성 미설치",
|
|
)
|
|
|
|
# 늘 빈칸(`Engine_Cross_Quantity` 근거 없음) = 누름 없음
|
|
NO_PICK = {"fence", "grubbing", "topsoil_fill", "topsoil_cut"}
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", os.path.join(HERE, "helper_150_detail_pick.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_표_키_22_모두_짝_또는_누름_없음(out):
|
|
assert set(out["targets"]) | NO_PICK == set(QUANTITY_VALUE_KEYS)
|
|
assert not set(out["targets"]) & NO_PICK
|
|
|
|
|
|
def test_판정_선_구역(out):
|
|
assert out["zone"] == {
|
|
"road": "road",
|
|
"ditch": "ditch",
|
|
"cutSlope": "cut_slope",
|
|
"fillSlope": "fill",
|
|
}
|
|
|
|
|
|
def test_칸마다_그림_강조(out):
|
|
active = out["active"]
|
|
assert active["null"] == [] # 카드에서 묻어 온 강조도 지움
|
|
assert active["cut_soil"] == ["b06-chart__area--cut_soil"]
|
|
assert active["cut_rock"] == ["b06-chart__area--cut_rock"]
|
|
assert active["embankment"] == ["b06-chart__area--fill"]
|
|
assert active["spoil_fill"] == ["b06-chart__spoil-fill"]
|
|
assert active["ground"] == ["b06-chart__center"]
|
|
assert active["ditch_soil"] == ["ditch"]
|
|
assert active["grading_cut"] == ["cutSlope"]
|
|
assert active["grading_fill"] == ["fillSlope"]
|
|
assert active["road_compaction"] == ["road"]
|
|
assert active["fence"] == []
|
|
|
|
|
|
def test_상세_표_칸_키_누름_배선():
|
|
with open(
|
|
os.path.join(ROOT, "B06_Section", "B06_Section_UI_Cross_Detail.ts"), encoding="utf-8"
|
|
) as f:
|
|
src = f.read()
|
|
assert "element.dataset.key = key" in src
|
|
assert "highlightDetail(svg, state.section.design, picked)" in src
|
|
assert 'closest<HTMLElement>("[data-key]")' in src
|
|
|
|
|
|
def test_상세_큰_창_공용_막_그림_글_표_순서():
|
|
"""150-2 — 투명 막 지움(밖 누르면 공용 닫기) · 큰 창 · 그림 → 글 → 표 · 스크롤 없음."""
|
|
base = os.path.join(ROOT, "B06_Section")
|
|
with open(os.path.join(base, "B06_Section_UI_Cross_Detail.ts"), encoding="utf-8") as f:
|
|
src = f.read()
|
|
with open(os.path.join(base, "B06_Section_UI_Style_Cross_Detail.css"), encoding="utf-8") as f:
|
|
css = f.read().replace(chr(13), "")
|
|
assert "wide: true" in src and "backdropClass" not in src
|
|
assert "body.append(cad, note, tableBox)" in src
|
|
assert "pointer-events: none" not in css and "b06-detail__backdrop" not in css
|
|
assert ".ui-modal.b06-detail > .ui-modal__body {\n overflow: hidden;" in css
|
|
assert "flex: 1;\n min-height: 0;" in css and "height: 100%;" in css
|