feat(B08): 수리 판정 글자색 — O K 초록 · N G 붉음 · 판정 없음 기본 글 · 배경 칠 없앰(132-1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""B08 수리 판정 글자색 (PLAN 132-1).
|
||||
|
||||
O K = 초록 글(success) · N G = 붉은 글(danger) · 판정 없음 = 기본 글 · 배경 칠 없음.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
CSS = (ROOT / "B08_Quantity" / "B08_Quantity_UI_Hydro.css").read_text(encoding="utf-8")
|
||||
TS = (ROOT / "B08_Quantity" / "B08_Quantity_UI_Hydro_Sheet.ts").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def rule(selector: str) -> str:
|
||||
match = re.search(re.escape(selector) + r"\s*\{([^}]*)\}", CSS)
|
||||
assert match, selector
|
||||
return match.group(1)
|
||||
|
||||
|
||||
def test_OK_는_success_글() -> None:
|
||||
assert "color: var(--color-success)" in rule(".b08-hydro__sheet.is-ok .is-key")
|
||||
|
||||
|
||||
def test_NG_는_danger_글() -> None:
|
||||
assert "color: var(--color-danger)" in rule(".b08-hydro__sheet.is-ng .is-key")
|
||||
|
||||
|
||||
def test_판정_없음은_기본_글() -> None:
|
||||
body = rule(".is-key.b08-hydro__out,\n.is-key.b08-hydro__verdict")
|
||||
assert "color: var(--color-text-body)" in body
|
||||
assert "--color-danger" not in body
|
||||
|
||||
|
||||
def test_배경_칠_없음() -> None:
|
||||
assert ".b08-hydro__verdict.is-ng" not in CSS
|
||||
assert "background" not in rule(".b08-hydro__sheet.is-ng .is-key")
|
||||
|
||||
|
||||
def test_판정이_장에_칠_갈래를_붙임() -> None:
|
||||
assert 'sheet.classList.toggle("is-ok", judged && r.ok === true)' in TS
|
||||
assert 'sheet.classList.toggle("is-ng", judged && !r.ok)' in TS
|
||||
Reference in New Issue
Block a user