- applySpan 노면공도 --span · revealStation(리스너 없이 옛 카드 풂 · 폼 유지) - focusChainage revealOnly · 세션 고름은 패널이 직접 - test_165 · test_106 기대값 고침 · 새 시험 test_177_4_pavement_span_box Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015sDZSjFvoiDjdGpgj3muc3
86 lines
3.5 KiB
Python
86 lines
3.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""PLAN 106 — 구간형 구조물 범위 강조 · B05/B06 화면 글 「흙막이」.
|
|
|
|
• 106-1 구조물을 고르면 시작~종료 안 횡단 카드 전부에 `--span` 클래스 · 카드를 다시 만들어도 유지
|
|
• 106-2 로케일 · 툴팁 · 정의 label 에 「기슭막이」 없음(독립=D군 · 사방 근거 글 빼고) · 저장 값 · choices 그대로
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import re
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
|
|
|
|
|
|
def _read(*parts: str) -> str:
|
|
with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle:
|
|
return handle.read()
|
|
|
|
|
|
VIEW = _read("B06_Section", "B06_Section_UI_Section_View.ts")
|
|
|
|
|
|
def test_범위_강조_클래스는_고름_목록갱신_카드재생성_세_길에서_칠한다():
|
|
# applySpan 한 곳 — syncSpanHighlights · buildCrossCard 가 부름
|
|
assert VIEW.count("b06-cross-card--span") == 1
|
|
assert re.search(
|
|
r"selectMark: \(structureId, span = true\) => \{\s+(//[^\n]*\s+)?spanMarkId = span \|\| isPavement\(structureId\) \? structureId : null;",
|
|
VIEW,
|
|
)
|
|
assert re.search(
|
|
r"spanMarks = structures;\s+spanTypes = types;\s+syncSpanHighlights\(\);", VIEW
|
|
)
|
|
assert VIEW.count("applySpan(card, section);") == 2
|
|
# 152-5 노면공(G군) 포장층 · 177-4 범위 카드 테두리도 함께
|
|
assert 'card.classList.toggle("b06-cross-card--span", span);' in VIEW
|
|
|
|
|
|
def test_측점_고름은_카드_하나_목록_고름은_여럿():
|
|
"""137-4 — 측점 고름 리스너는 span 끔 · 목록(노면공) 길 · 알약은 기본(여럿) 그대로."""
|
|
cross = _read("A00_Common", "design", "design_view_cross.ts")
|
|
assert "sectionView.selectMark(mark, false);" in cross # 152-5 덮는 것 없으면 null = 풂
|
|
assert "markStructure: (structureId) => sectionView.selectMark(structureId)," in cross
|
|
types = _read("B06_Section", "B06_Section_UI_Section_View_Types.ts")
|
|
assert "selectMark: (structureId: string | null, span?: boolean) => void;" in types
|
|
|
|
|
|
def test_범위_판정은_시작_종료가_다른_구간형만():
|
|
assert "start == null || end == null || start === end" in VIEW
|
|
|
|
|
|
def test_범위_강조_CSS는_선택_강조를_덮지_않는다():
|
|
css = _read("B06_Section", "B06_Section_UI_Style_Cross.css")
|
|
assert ".b06-cross-card--span:not(.b06-cross-card--selected)" in css
|
|
|
|
|
|
def test_로케일에_기슭막이는_독립_한_곳뿐():
|
|
locale = _read("ui_template", "ui_template_locale_b2.ts")
|
|
korean = [
|
|
line
|
|
for line in locale.splitlines()
|
|
if "기슭막이" in line and not line.strip().startswith(("//", "/*"))
|
|
]
|
|
assert len(korean) == 1 and "B06_Cross_Revet_Own" in korean[0]
|
|
|
|
|
|
def test_정의_label은_흙막이_choices_값은_그대로():
|
|
definition = json.loads(_read("resources", "master_template", "구조물정의.json"))
|
|
labels, choices = [], []
|
|
|
|
def walk(node):
|
|
if isinstance(node, dict):
|
|
if isinstance(node.get("label"), str):
|
|
labels.append(node["label"])
|
|
if node.get("key") in ("inlet_type", "outlet_type"):
|
|
choices.append(node["choices"])
|
|
for value in node.values():
|
|
walk(value)
|
|
elif isinstance(node, list):
|
|
for value in node:
|
|
walk(value)
|
|
|
|
walk(definition)
|
|
assert not [label for label in labels if "기슭막이" in label and label != "기슭막이"]
|
|
assert ["기슭막이", "집수정"] in choices and ["기슭막이"] in choices
|