- 단가산출 화면 열 때 /sangeun/calc 부름 수(바탕 있음 2 · 없음 1) · 숨은 상세 몸 DOM 2 - 일위대가 줄 누름 — SK 참조 줄 = 그 SK 줄 쌓기 · M01 로직 줄 = 옛 줄 모달(상세 몸) · 셈 주입 줄 - 머리 띠 넷(까닭 · M01 개정 · 빠진 줄 · 짝 잃음) 견본 답 · M01 로직 상세 그릇 꼴 - 지금 수치 그대로 단언 — 856-1 에서 뒤집음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
3.4 KiB
Python
78 lines
3.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""PLAN 856-0 — 단가산출 화면 지킴(가짜 DOM · 진짜 코드 · `helper_856_0_sk_screen.cjs`).
|
|
|
|
① 단가산출 화면을 열 때 서버 `/sangeun/calc` 부름 수 · 숨은 상세 몸 DOM · 줄 쌓기 그림
|
|
② 일위대가 표 줄 누름 — 단가산출(SK) 참조 줄 = 그 SK 줄 쌓기 · M01 로직 줄 · 셈 주입(프로젝트 사본) 줄
|
|
③ 머리 띠 넷(까닭 · M01 개정 · 빠진 줄 · 짝 잃음)이 뜨는 경우 — 견본 답
|
|
④ M01 로직 상세 그릇 = 기본정보 접힘 + 줄 쌓기
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
from functools import lru_cache
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
@lru_cache(maxsize=1)
|
|
def _run() -> dict:
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_856_0_sk_screen.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
)
|
|
assert proc.returncode == 0, proc.stderr[-3000:]
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_sk_page_open_calls_and_hidden_body() -> None:
|
|
got = _run()
|
|
# 바탕 있는 SK = 셈 두 번(바탕 원값 bare) · 바탕 없음 = 한 번 · 상세 몸 DOM 둘(덮개 그릇 · 호표) 숨김
|
|
assert got["page_base"]["calc"] == 2
|
|
assert got["page_nobase"]["calc"] == 1
|
|
for k in ("page_base", "page_nobase", "memory"):
|
|
assert got[k]["body"] == 2, k
|
|
assert got[k]["bodyShown"] == 0, k
|
|
assert got[k]["stack"]["shown"] is True, k
|
|
assert {d["key"] for d in got["page_base"]["stack"]["draws"]} == {"SK-000001"}
|
|
# 불러오기 미리 보기(저장 전 가져온 식) = 빈 키 + 문서째
|
|
assert all(d == {"key": "", "memory": True} for d in got["memory"]["stack"]["draws"])
|
|
assert got["memory"]["calc"] == 1
|
|
|
|
|
|
def test_labor_row_click() -> None:
|
|
sk, logic = _run()["labor"]
|
|
# 단가산출 참조 줄 = 그 SK 문서 모달 · 줄 쌓기가 그 키로 보임 · 몸 안 보임
|
|
assert sk["skModal"] == 1 and sk["stack"]["shown"] is True
|
|
assert set(sk["stack"]["draws"]) == {"SK-000010"} and sk["body"] == 0
|
|
# M01 로직 줄 = 옛 줄 모달 — 줄 쌓기 숨김 · 상세 몸 보임 · 안내 띠 하나 · 셈 둘(정체 + 상세)
|
|
assert logic["skModal"] == 0 and logic["stack"]["shown"] is False
|
|
assert logic["body"] == 1 and logic["banners"] == ["info"] and logic["calc"] == 2
|
|
|
|
|
|
def test_labor_row_click_inject() -> None:
|
|
sk, logic = _run()["labor_inject"]
|
|
# 셈 주입(프로젝트 사본) = 옛 줄 모달 · 상세 없음 · 안내 띠 없음 · 셈 없음
|
|
for row in (sk, logic):
|
|
assert row["modal"] and row["stack"] is None
|
|
assert row["body"] == 0 and row["banners"] == [] and row["calc"] == 0
|
|
|
|
|
|
def test_head_bands_four() -> None:
|
|
got = _run()
|
|
# 까닭(빨강) · M01 개정 · 빠진 줄 · 짝 잃음(노랑) + 머리 배지 · 개정 배지
|
|
assert got["bands"]["banners"] == ["danger", "warning", "warning", "warning"]
|
|
assert got["bands"]["badges"] == [["info", "계"], ["danger", "M02_SangeunRevisedBase"]]
|
|
# 서버 못 닿음 = 빨강 하나
|
|
assert got["bands_fail"]["banners"] == ["danger"]
|
|
assert got["page_base"]["banners"] == [] and got["page_base"]["badges"] == []
|
|
|
|
|
|
def test_m01_logic_detail_shape() -> None:
|
|
# 기본정보 접힘 · 막힘 까닭 · 줄 쌓기 — 단가산출 상세 몸 칸 없음
|
|
assert _run()["m01"] == ["DETAILS", "DIV", "DIV:stack"]
|