Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
69 lines
2.6 KiB
Python
69 lines
2.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_범위_강조_클래스는_고름_목록갱신_카드재생성_세_길에서_칠한다():
|
|
assert VIEW.count("b06-cross-card--span") == 2 # syncSpanHighlights · buildCrossCard
|
|
assert re.search(r"selectMark: \(structureId\) => \{\s+spanMarkId = structureId;", VIEW)
|
|
assert re.search(r"spanMarks = structures;\s+syncSpanHighlights\(\);", VIEW)
|
|
assert 'card.classList.toggle("b06-cross-card--span", inSpan(section))' in VIEW
|
|
|
|
|
|
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
|