Files
Aislo/resources/tester/test_106_span_highlight_wording.py
T
eomsangdonandClaude Opus 5.5 40126051dc refactor(859-5 ③④): 구조물 정의 자료 master_template → master_data/구조물정의
- 구조물정의.json → resources/master_data/구조물정의/구조물정의.json(git mv · 내용 그대로)
- 구조물정의_이력/판_1 ~ 22 → resources/master_data/구조물정의/이력/(git mv · 내용 그대로)
- 읽는 자리 = B05 Structures_Schema DEFINITION_PATH · HISTORY_DIRNAME · M01_SO_Definition HISTORY
- M01 요소 로더 · check_master 는 첫 층 *.json 만 읽음 — 새 폴더는 요소로 안 읽힘(수식문서/ 와 같은 대접)
- 시험 · 도우미 · ui_checks 경로 글 고침(파일 이름 그대로)
- resources/master_template 에 구조물 정의 자료 남지 않음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:09:35 +09:00

89 lines
3.6 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 = 풂
# 목록 길 = 기본(여럿) · 측점 고름이 연 폼만 span 끔(231-1)
assert (
"markStructure: (structureId, span) => sectionView.selectMark(structureId, span)," 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_data", "구조물정의", "구조물정의.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