- 위 탭 총괄설계내역서 · 설계내역서 = 「설계내역」 한 묶음(총괄 · 설계내역서) - 단가연결 칸 = 램프(초록 연결 · 노랑 없음) · 풍선 = 글 · 머리 「단가↵연결」 · 폭 44 - 시험 test_257_1 · test_181_1 · test_229_1 기대값 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SE9MxeXTu2uaDZ55BJowAY
59 lines
2.6 KiB
Python
59 lines
2.6 KiB
Python
"""257-1 B09 위 탭 「설계내역」(총괄설계내역서 · 설계내역서 한 묶음) · 설계내역서 단가연결 칸 램프.
|
|
|
|
- 위 탭 = `TAB_GROUPS` 「설계내역」[total, bill] · 옛 두 위 탭 없음
|
|
- 단가연결 칸 = 줄 칸 class `b09-bill__lamp`(+ 연결 `is-linked`) · 풍선 = 글(대가N · 연결됨 · 단가연결)
|
|
- 머리 = 「단가↵연결」 · 폭 44 · 머리 CSS pre-line
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from resources.tester.test_184_3_b09_bill_menu import ROWS, SRC, _node, _ts # noqa: E402
|
|
|
|
JS = """
|
|
const ctx = { sheets: { bill: { rows: __ROWS__, totals: null } }, payload: {}, user: {}, setUser() {} };
|
|
const table = buildBill(ctx);
|
|
const at = (key) => table.rows.findIndex((r) => r.key === key);
|
|
const keys = ["earth:4", "earth:5", "hand:a", "mat:M1", "fee", "sec:1"];
|
|
const col = table.columns.find((c) => c.key === "connect");
|
|
console.log(JSON.stringify({
|
|
col: { label: col.label, width: col.width, title: col.title },
|
|
cls: keys.map((k) => table.cellClass(at(k), "connect")),
|
|
tip: keys.map((k) => table.tip(at(k), "connect")),
|
|
other: table.cellClass(at("earth:4"), "qty"),
|
|
groups: TAB_GROUPS.map(([label, tabs]) => [label, tabs]),
|
|
}));
|
|
"""
|
|
|
|
|
|
def test_램프_칸_class_풍선_머리():
|
|
body = JS.replace("__ROWS__", json.dumps(ROWS, ensure_ascii=False))
|
|
out = json.loads(_node(_ts([*SRC, "UI_Tabs_Bill"]) + body))
|
|
assert out["col"] == {"label": "단가\n연결", "width": 44, "title": "단가연결"}
|
|
assert out["cls"] == [
|
|
"b09-bill__lamp is-linked", # 자동 줄 · 호표 연결
|
|
"b09-bill__lamp", # 연결 없음 = 노랑
|
|
"b09-bill__lamp is-linked", # 손 줄 · 비고 대가3
|
|
None, # 자재 줄 = 연결 대상 아님
|
|
None,
|
|
None, # 묶음 줄
|
|
]
|
|
assert out["tip"] == ["연결됨", "단가연결", "대가3", None, None, None]
|
|
assert out["other"] is None
|
|
labels = [g[0] for g in out["groups"]]
|
|
assert "설계내역" in labels and "총괄설계내역서" not in labels and "설계내역서" not in labels
|
|
assert ["설계내역", ["total", "bill"]] in out["groups"]
|
|
|
|
|
|
def test_CSS_램프_초록_노랑_머리_줄바꿈():
|
|
css = (ROOT / "B09_Estimation" / "B09_Estimation_UI_Page.css").read_text("utf-8")
|
|
assert "td.b09-bill__lamp::before" in css and "var(--color-warning)" in css
|
|
assert "td.b09-bill__lamp.is-linked::before" in css and "var(--color-success)" in css
|
|
head = css.split("[data-b09-table] thead th {", 1)[1].split("}", 1)[0]
|
|
assert "white-space: pre-line" in head
|