- 셈 구동 떼기: 새 M01_MasterData_UI_Logic_Drive.ts(driveRun · previewText · autoFill · createDrive) — M01 상세는 숨은 시험 계산 칸 단추 대신 구동 함수 · 시험 계산 칸(Logic_Calc)은 로직 복사 화면이 쓰므로 남기고 같은 구동을 부름 · 재료 고름은 rerun 고리 - M02: 새 _Sangeun_Tabs.ts(수식 · 단가산출 상세 보기 고르기) · Detail 의 시험 계산 · 인력/재료/경비 걷음 - 걷은 파일(git rm): M01 LogicLab_Sheet · Logic_Sheet_Model · LogicLab_Formula(.ts .css) · FormulaTokens · LogicLab_Est / M02 Sangeun_Sheet(.ts .css) · SheetEdit · SheetFormula · logic Sheet_Model · Const_Model · Formula_Model · 부품 시트 줄(createCalcSheetRow) · Cover_Model.sheetGroups · Calc 의 M02 고리(answer · shown · held) · 죽은 CSS · 글 - 서버 길 · 문서 칸(변수줄 · 글줄 · 덮개)은 남김 — 금액 그대로 - 낡은 시험: test_790_1(시트 화면 전부) · test_714_3 · test_748_2(+ helper)는 화면이 없어져 지움 · test_794_1 · test_790_2 는 화면 · TS 거울만 덜고 서버 시험 남김 · test_714_2 · 717_2b · 721 · 722(원래 틀린 한 줄 고침) · 734 · 737 · 750_2 · 793_3b · 796_2 · 796_2b 는 보기 둘 · 새 파일에 맞춤 · 새 test_799_2_old_tabs_gone Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
92 lines
4.0 KiB
Python
92 lines
4.0 KiB
Python
# ruff: noqa: E501
|
|
"""799-2 옛 탭 넷 걷음 지킴 — 시트 · 인력/재료/경비 · 시험 계산 · 텍스트 수식 (M01 로직 상세 · M02 단가산출 상세).
|
|
|
|
- 걷은 파일은 없고 어디서도 안 부름 · 보기 = 수식 · 단가산출 상세 둘 · 기본정보는 맨 위
|
|
- 셈 구동은 화면 칸 없이 `_Logic_Drive.ts`(서버 셈) — M01 상세는 구동만 · 시험 계산 칸(`Logic_Calc`)은 로직 복사 화면 몫
|
|
- 서버 길은 남김(`/logic/sheet` · 시트 문서 칸 · 수식 검사가 같은 엔진)
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
M01 = ROOT / "M01_MasterData"
|
|
M02 = ROOT / "M02_MasterTemplete"
|
|
GONE = [
|
|
M01 / "M01_MasterData_UI_LogicLab_Sheet.ts",
|
|
M01 / "logic" / "M01_Logic_Sheet_Model.ts",
|
|
M01 / "M01_MasterData_UI_LogicLab_Formula.ts",
|
|
M01 / "M01_MasterData_UI_LogicLab_FormulaTokens.ts",
|
|
M01 / "M01_MasterData_UI_LogicLab_Formula.css",
|
|
M01 / "M01_MasterData_UI_LogicLab_Est.ts",
|
|
M02 / "M02_MasterTemplete_Sangeun_Sheet.ts",
|
|
M02 / "M02_MasterTemplete_Sangeun_SheetEdit.ts",
|
|
M02 / "M02_MasterTemplete_Sangeun_SheetFormula.ts",
|
|
M02 / "M02_MasterTemplete_Sangeun_Sheet.css",
|
|
M02 / "logic" / "M02_Sangeun_Sheet_Model.ts",
|
|
M02 / "logic" / "M02_Sangeun_Const_Model.ts",
|
|
M02 / "logic" / "M02_Sangeun_Formula_Model.ts",
|
|
]
|
|
|
|
|
|
def _text(p: Path) -> str:
|
|
return p.read_text(encoding="utf-8")
|
|
|
|
|
|
def _tracked() -> list[Path]:
|
|
out = subprocess.run(
|
|
["git", "-c", "core.quotepath=off", "ls-files", "*.ts", "*.css"],
|
|
cwd=ROOT, capture_output=True, text=True, encoding="utf-8", check=True,
|
|
).stdout # fmt: skip
|
|
return [ROOT / x for x in out.splitlines() if x and not x.startswith(("docs/", "tmp/"))]
|
|
|
|
|
|
def test_걷은_파일_없고_부르는_곳_없음():
|
|
assert not [p for p in GONE if p.exists()]
|
|
names = [p.name.rsplit(".", 1)[0] for p in GONE]
|
|
for p in _tracked():
|
|
text = _text(p)
|
|
for n in names:
|
|
assert f'/{n}"' not in text and f'./{n}"' not in text and f"{n}.css" not in text, (
|
|
p.name,
|
|
n,
|
|
)
|
|
|
|
|
|
def test_보기는_수식_단가산출상세_둘():
|
|
m01 = _text(M01 / "M01_MasterData_UI_LogicLab_View.ts")
|
|
m02 = _text(M02 / "M02_MasterTemplete_Sangeun_Tabs.ts")
|
|
for src in (m01, m02):
|
|
assert re.findall(r'\{ value: "(\w+)", label: ', src) == ["equation", "ho"]
|
|
assert 'export type LabView = "equation" | "ho";' in m01
|
|
css = _text(M01 / "M01_MasterData_UI_LogicLab_Style.css")
|
|
assert '[data-view="ho"] [data-block]:not([data-block="ho"])' in css
|
|
assert 'data-view="sheet"' not in css and 'data-view="calc"' not in css
|
|
|
|
|
|
def test_셈_구동은_화면_없이_상세는_구동만():
|
|
drive = _text(M01 / "M01_MasterData_UI_Logic_Drive.ts")
|
|
assert "document." not in drive and "sessionStorage." not in drive
|
|
assert "export async function driveRun(" in drive and "export function createDrive(" in drive
|
|
lab = _text(M01 / "M01_MasterData_UI_LogicLab.ts")
|
|
assert "createDrive()" in lab and "buildCalc" not in lab and "data-calc-run" not in lab
|
|
assert "rerun: () => void drive.run()," in lab
|
|
detail = _text(M01 / "M01_MasterData_UI_LogicLab_Detail.ts")
|
|
assert "calcHost" not in detail and "data-calc-run" not in detail and "ctx.rerun?.()" in detail
|
|
calc = _text(
|
|
M01 / "M01_MasterData_UI_Logic_Calc.ts"
|
|
) # 로직 복사 화면이 쓰는 시험 계산 칸 — 구동은 공용
|
|
assert "driveRun(ctx)" in calc and "runCalc" not in calc
|
|
m02 = _text(M02 / "M02_MasterTemplete_Sangeun_Detail.ts")
|
|
assert "buildCalc" not in m02 and "calcHost" not in m02 and "createSangeunTabs(editor" in m02
|
|
|
|
|
|
def test_파일_700줄_안():
|
|
for p in (M01 / "M01_MasterData_UI_LogicLab.ts", M01 / "M01_MasterData_UI_LogicLab_Detail.ts",
|
|
M02 / "M02_MasterTemplete_Sangeun_Detail.ts", M02 / "M02_MasterTemplete_Sangeun_Tabs.ts",
|
|
M01 / "M01_MasterData_UI_Logic_Drive.ts"): # fmt: skip
|
|
assert len(_text(p).splitlines()) <= 700, p.name
|