- 공용 틀 — 제목 줄(제목 · 저장 안 한 점 ● · 오른쪽 단추 자리) + 한 줄 부제(번호 · 이름 · 말줄임) · 상태(불러오는 중 · 실패 + 다시 불러오기 · 비었음) · [저장](늘 보임 · 고쳐야 켜짐 · 카드 안 Ctrl+S · 알림 글 한 벌) · ?(단축키 상자) - 도면 정보 · 면적산출 · 재료산출(ItemCards) · 선택 입력(관리 화면 · 고르기 모달 값 카드)이 틀에 내용만 넣음 - 「〇〇 수정」 빈 단추 한 모양 · 엑셀 카드에도 ? · 불러오는 중 네 카드 · 실패는 카드 안 글(토스트 안 씀) · 물음 한 번(어느 카드든) - 저장 길(saveTemplate · 도면 write · sheetEdit.save · 위 [저장] saveInputs) · 단축키는 그대로 · 고르기 모달은 보기만 - 시험 test_m02_card_shell 새로 · 옛 모양 시험 맞춤 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
3.9 KiB
Python
78 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 saveSheet")[1].split("\n }\n")[0]
|
|
assert "...(c.doc as unknown as Record<string, unknown>), ...c.handle.getDoc()" in save
|
|
assert "c.version = await opts.sheetEdit.save(c.kind, at, next, 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
|