Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
82 lines
4.1 KiB
Python
82 lines
4.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""170 B08 구조물도 모달 — 머리 단추(170-2) · 칩 테두리 상태 색(170-3) · 집계표 보조 탭 줄 자리(170-4).
|
|
|
|
화면 글 판정 — 공용 모달(ui_template_modal)은 안 고침.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
PAGE = (ROOT / "B08_Quantity/B08_Quantity_UI_Page.ts").read_text(encoding="utf-8")
|
|
PAGE_CSS = (ROOT / "B08_Quantity/B08_Quantity_UI_Page.css").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_170_4_집계표_보조_탭_줄_자리():
|
|
branch = PAGE.split('if (tab === "summary" && projectId) {', 1)[1].split("\n }", 1)[0]
|
|
# 자재 탭 보조 탭 줄과 같은 클래스 · sm 단추 하나(보이지 않음 · 초점 안 감)
|
|
assert '"b08-quantity__tabs b08-quantity__tabs--blank"' in branch
|
|
assert 'size: "sm"' in branch and "ghost.tabIndex = -1" in branch
|
|
assert 'setAttribute("aria-hidden", "true")' in branch
|
|
# 집계표는 줄 아래 몸통에 그림(replaceChildren 이 빈 줄을 지우지 않게)
|
|
assert (
|
|
"view.append(blank, body)" in branch and "renderStructureSummary(body, projectId)" in branch
|
|
)
|
|
assert ".b08-quantity__tabs--blank > .ui-btn {\n visibility: hidden;" in PAGE_CSS.replace(
|
|
"\r\n", "\n"
|
|
)
|
|
|
|
|
|
LINK = (ROOT / "B08_Quantity/B08_Quantity_UI_Link.ts").read_text(encoding="utf-8")
|
|
DRAWING_CSS = (ROOT / "B08_Quantity/B08_Quantity_UI_Drawing.css").read_text(encoding="utf-8")
|
|
THEME = (ROOT / "ui_template/ui_template_theme.css").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_170_3_칩_테두리_상태_색():
|
|
assert 'slot.linked ? "b08-link__chip is-linked" : "b08-link__chip is-missing"' in LINK
|
|
assert "paintCopyState(projectId, slot, chip, badges, updateButton)" in LINK
|
|
# 앞섬 = 없어짐 › 바뀜 › 고침 › 연결
|
|
tone = LINK.split("const tone = info.원본없음", 1)[1].split(";", 1)[0]
|
|
assert tone.index('"is-gone"') < tone.index('"is-changed"') < tone.index('"is-edited"')
|
|
assert 'chip.classList.replace("is-linked", tone)' in LINK
|
|
for cls, token in (
|
|
("is-linked", "success"),
|
|
("is-missing", "danger"),
|
|
("is-changed", "warning"),
|
|
("is-edited", "info"),
|
|
("is-gone", "danger"),
|
|
):
|
|
rule = DRAWING_CSS.split(f".b08-link__chip.{cls} {{", 1)[1].split("}", 1)[0]
|
|
assert f"border-color: var(--color-{token});" in rule
|
|
assert f"--color-{token}:" in THEME # 밝음 · 어두움 토큰
|
|
assert (
|
|
"border-style: dashed;"
|
|
in DRAWING_CSS.split(".b08-link__chip.is-gone {", 1)[1].split("}", 1)[0]
|
|
)
|
|
|
|
|
|
DRAWING = (ROOT / "B08_Quantity/B08_Quantity_UI_Drawing.ts").read_text(encoding="utf-8")
|
|
EDIT = (ROOT / "ui_template/ui_template_item_picker_edit.ts").read_text(encoding="utf-8")
|
|
PICKER = (ROOT / "ui_template/ui_template_item_picker.ts").read_text(encoding="utf-8")
|
|
MODAL = (ROOT / "ui_template/ui_template_modal.ts").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_170_2_편집_화면_단추_모달_머리():
|
|
# 편집 화면이 두 단추를 내보냄 · 고르기 모달(142-1)은 그대로 안 씀
|
|
assert "back: HTMLButtonElement;" in EDIT and "save: HTMLButtonElement;" in EDIT
|
|
assert "return { root, back, save," in EDIT
|
|
assert "view.back" not in PICKER and "view.save" not in PICKER
|
|
# 빈 머리 칸을 열 때 미리 넘김(공용 모달은 mount 때 자식 있을 때만 머리에 붙임)
|
|
assert "if (actions.childElementCount) closeButton.before(actions)" in MODAL
|
|
assert "actions: [head]," in DRAWING and "head.hidden = true;" in DRAWING
|
|
# 들어갈 때 옮김 · 크기 = [닫기](md) · 차례 [← 뒤로] [저장] [닫기]
|
|
assert 'view.back.classList.remove("ui-btn--sm")' in DRAWING
|
|
assert 'view.save.classList.remove("ui-btn--sm")' in DRAWING
|
|
assert "head.replaceChildren(view.back, view.save);\n head.hidden = false;" in DRAWING
|
|
# 나올 때([뒤로] · 닫기) 거둠
|
|
back = DRAWING.split("(saved) => {", 1)[1].split("},", 1)[0]
|
|
assert "clearHead();" in back
|
|
closing = DRAWING.split("beforeClose: async () => {", 1)[1].split("return true;", 1)[0]
|
|
assert "clearHead();" in closing
|
|
css = DRAWING_CSS
|
|
assert ".b08-sheets .ui-modal__actions[hidden] {\n display: none;" in css
|