- 스프레드시트 옵션 preview 한 곳 — 도구 모음 · 오른쪽 클릭 메뉴 없이 수식 입력 줄 · 칸 고침 · 단축키 · 알약 줄(다른 화면 그대로) - 항목 카드 sheetEdit(있을 때만 고침 · 고르기 모달은 보기만 그대로) · 카드 [저장] = 읽은 문서에 시트를 덮어 saveTemplate(전체 편집기와 같은 길 · 번호 칸 유지) - 알약 · 자재 조합 판은 전체 편집기와 같은 부품 — 면적 = pillsFor · 재료 = 담은 자재 + 선택 입력 알약 · 「+ 자재 추가」 · 아래 자재 조합 판(추가 · 빼기 · 적용) - 저장 안 한 카드 고침 — 다른 항목 고르면 물음(머물면 고른 열 되돌림) · 떠나기 · 나무 고침 · 새로고침 막기도 물음 · 위 [저장]도 카드를 먼저 저장 - 카드 안 [자재 추가] 창 목록 높이를 줄여 안 잘리게 - 시험 test_m02_card_sheet_edit 새로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ly2oHAaTDYRjcniAmHR81z
79 lines
3.9 KiB
Python
79 lines
3.9 KiB
Python
"""면적산출 · 재료산출 카드 미리보기 수정(PLAN 31-3) — 화면 조작은 ORCA.
|
|
|
|
· 스프레드시트 `preview` = 도구 모음 · 오른쪽 클릭 메뉴 없음 · 수식 입력 줄 · 칸 고침
|
|
(다른 화면 그대로)
|
|
· 카드 = `sheetEdit` 가 있을 때만 고침(M02 구조물 조합) · 고르기 모달은 보기만 그대로
|
|
· 알약 · 자재 조합 판 = 전체 편집기와 같은 부품 · 카드 [저장] = 같은 저장 길 · 저장 안 한 고침 물음
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
M02 = ROOT / "M02_MasterTemplete"
|
|
|
|
|
|
def _text(path: Path) -> str:
|
|
return path.read_text(encoding="utf-8")
|
|
|
|
|
|
def test_스프레드시트_미리보기_수정_옵션():
|
|
src = _text(ROOT / "A00_Common" / "spreadsheet" / "spreadsheet.ts")
|
|
assert "preview?: boolean;" in src
|
|
assert "const bare = readOnly || !!opts.preview;" in src
|
|
assert "bare ? null : mountToolbar(ctx)" in src and "bare ? null : attachMenu(ctx)" in src
|
|
# 편집 · 수식 입력 줄은 readOnly 만 막음 — preview 는 고칠 수 있음
|
|
assert "const readOnly = !!opts.readOnly;" in src
|
|
assert re.search(r"for \(const node of \[toolbar\?\.root, ed\.bar, grid\.root", src)
|
|
|
|
|
|
def test_카드는_sheetEdit_있을_때만_고침():
|
|
cards = _text(M02 / "M02_MasterTemplete_ItemCards.ts")
|
|
assert "sheetEdit?: SheetEditOptions;" in cards
|
|
assert (
|
|
"if (opts.sheetEdit?.can()) return await paintEditable(c, mine, createSpreadsheet);"
|
|
in cards
|
|
)
|
|
body = cards.split("const paintEditable")[1].split("const paintSheet")[0]
|
|
assert "preview: true," in body and "links," in body
|
|
assert "c.host.append(extra.below)" in body # 재료산출 = 자재 조합 판
|
|
# 보기만 길 그대로(고르기 모달)
|
|
assert "createSpreadsheet(c.host, c.doc, { readOnly: true, tabs: false })" in cards
|
|
detail = _text(ROOT / "ui_template" / "ui_template_item_picker_detail.ts")
|
|
assert "sheetEdit" not in detail
|
|
|
|
|
|
def test_카드_저장은_읽은_문서에_시트를_덮음():
|
|
cards = _text(M02 / "M02_MasterTemplete_ItemCards.ts")
|
|
save = cards.split("async function saveCard")[1].split("\n }\n")[0]
|
|
assert "...(c.doc as unknown as Record<string, unknown>)," in save
|
|
assert "...c.handle.getDoc()," in save
|
|
assert "c.version = await opts.sheetEdit.save(c.kind, at, doc, c.version);" in save
|
|
assert 'c.version = String((got.value as { 판?: string | null }).판 ?? "");' in cards
|
|
struct = _text(M02 / "M02_MasterTemplete_Structure.ts")
|
|
assert "saveTemplate(getActiveLayer(), kind, at, null, version, doc)" in struct
|
|
|
|
|
|
def test_알약_자재_조합_판은_전체_편집기와_같은_부품():
|
|
struct = _text(M02 / "M02_MasterTemplete_Structure.ts")
|
|
links = struct.split("async function cardLinks")[1].split("export interface")[0]
|
|
assert 'pillsFor("area", ctl.column)' in links
|
|
assert "loadMaterialState(ctl.column)" in links and 'inputPills(ctl.column, "재료")' in links
|
|
assert "toPills(items)" in links and "자재찾기: searchMaterials" in links
|
|
assert "buildMaterialPanel({" in links and "ctl.remount(links())" in links
|
|
assert "can: () => opts.isAdmin" in struct
|
|
|
|
|
|
def test_저장_안_한_카드_고침_물음():
|
|
struct = _text(M02 / "M02_MasterTemplete_Structure.ts")
|
|
show = struct.split("const show = ")[1].split("const pickPrice")[0]
|
|
assert "cards.dirty()" in show and "showConfirmDialog(TEXT.discardCards)" in show
|
|
assert "opts.keepColumn?.(from)" in show
|
|
main = _text(M02 / "M02_MasterTemplete_UI_Main.ts")
|
|
assert "const busy = (): boolean => dirty || !!panel?.dirty();" in main
|
|
assert main.count("busy()") >= 3 # 떠나기 · 새로고침 막기 · 나무 고침(settle)
|
|
assert main.index("await panel.saveCards();") < main.index("await panel.reload();")
|
|
assert "keepColumn: (colId) => sheet?.selectColumn(colId)" in main
|