- 고른 출처 단가 칸 = 바탕 색 대신 초록 테두리(안쪽 상자 그림자) - 적용 단가 칸 · 고른 출처 단가 칸 우클릭 = 「적용 단가 바꾸기」 → 출처 목록(왼쪽 누름 메뉴와 같은 항목) - 칸 우클릭 메뉴 한 자리(TabTable cellMenu · 쉘 배선) - 시험 test_257_3 · test_183_3 기대값 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SE9MxeXTu2uaDZ55BJowAY
68 lines
3.3 KiB
Python
68 lines
3.3 KiB
Python
"""257-3 B09 자재단가대비표 적용 단가 — 초록 테두리 · 우클릭 「적용 단가 바꾸기」(출처 목록).
|
|
|
|
- 고른 출처 단가 칸 = 초록 테두리(inset box-shadow · 바탕 색 아님)
|
|
- 우클릭 = 적용 단가 칸 · 고른 출처 단가 칸 → 「적용 단가 바꾸기」 하위 목록(왼쪽 누름 메뉴와 같은 항목 · 최저가여도 바꿈)
|
|
- 왼쪽 누름 메뉴(choices)는 그대로
|
|
"""
|
|
|
|
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.helper_b09_group_cards import TABS, run # noqa: E402
|
|
|
|
BASE = "B09_Estimation/B09_Estimation_UI_Tabs_Base.ts"
|
|
PRELUDE = r"""
|
|
const SOURCES = ["관급", "물가정보", "물가자료", "유통물가", "견적"];
|
|
const openQuotes = () => {};
|
|
"""
|
|
|
|
JS = """
|
|
let user = {};
|
|
const sheets = { compare: [
|
|
{ key: "m1", no: 1, name: "철근", spec: "D13", unit: "kg", lowest: 1000, lowest_from: "유통물가",
|
|
applied: 1000, applied_from: "유통물가", pick: null,
|
|
prices: { 관급: null, 물가정보: 1200, 물가자료: 0, 유통물가: 1000, 견적: null } },
|
|
] };
|
|
const t = buildCompare({ sheets, get user() { return user; }, setUser: (u) => (user = u) });
|
|
const menu = t.cellMenu(0, "applied");
|
|
const labels = menu[0].children.map((c) => c[0]);
|
|
menu[0].children[0][1](); // 물가정보 = 최저가 아닌 출처로 바꿈
|
|
const afterPick = JSON.stringify(user.materials);
|
|
menu[0].children[1][1](); // 유통물가 = 최저가여도 고른 출처로 박음
|
|
const afterLowest = JSON.stringify(user.materials);
|
|
console.log(JSON.stringify({
|
|
label: menu[0].label, labels, afterPick, afterLowest,
|
|
onPicked: t.cellMenu(0, "p:유통물가")?.[0].label ?? null,
|
|
other: [t.cellMenu(0, "name"), t.cellMenu(0, "p:물가정보"), t.cellMenu(5, "applied")],
|
|
left: t.choices(0, "applied").length, leftOther: t.choices(0, "name"),
|
|
cls: [t.cellClass(0, "p:유통물가"), t.cellClass(0, "p:물가정보")],
|
|
}));
|
|
"""
|
|
|
|
|
|
def test_우클릭_적용_단가_바꾸기_출처_목록():
|
|
out = run([TABS, BASE], JS, PRELUDE)
|
|
assert out["label"] == "적용 단가 바꾸기"
|
|
assert out["labels"] == ["물가정보 1,200", "✓ 유통물가 1,000 · 최저", "✓ 최저(자동)"]
|
|
assert out["afterPick"] == '{"m1":{"pick":"물가정보"}}'
|
|
assert out["afterLowest"] == '{"m1":{"pick":"유통물가"}}' # 최저가여도 바꿈
|
|
assert out["onPicked"] == "적용 단가 바꾸기" # 초록 테두리 칸 우클릭도 같은 메뉴
|
|
assert out["other"] == [None, None, None]
|
|
assert (
|
|
out["left"] == 4 and out["leftOther"] is None
|
|
) # 왼쪽 누름 메뉴 그대로(출처 둘 · 구분선 · 최저)
|
|
assert out["cls"] == ["is-picked", None]
|
|
|
|
|
|
def test_배선_쉘_우클릭_CSS_초록_테두리():
|
|
shell = (ROOT / "B09_Estimation" / "B09_Estimation_UI_Shell.ts").read_text("utf-8")
|
|
assert 'made.root.addEventListener("contextmenu"' in shell and "spec.cellMenu" in shell
|
|
assert "openMenuAt(event.clientX, event.clientY, items)" in shell
|
|
css = (ROOT / "B09_Estimation" / "B09_Estimation_UI_Page.css").read_text("utf-8")
|
|
box = css.split("td.is-picked {", 1)[1].split("}", 1)[0]
|
|
assert "box-shadow: inset 0 0 0 2px var(--color-success)" in box and "background" not in box
|