Files
Aislo/resources/tester/helper_m02_treepanel.cjs
T
eomsangdonandClaude Opus 5.5 c1ad11e869 feat(M02): 좌측 같은 이름 단추 · 나무 뿌리 줄 없앰 · 「+」 더하기 · 찾기 하나(AND) (PLAN 29-6)
- 「일위대가 조합」 · 「구조물 조합」 컨테이너 안 같은 이름 줄 단추 없앰 — 제목을 펼치면 그 화면을 엶
- 나무 맨 위 뿌리 줄 없앰 — 폴더 · 항목부터 · 맨 위 더하기는 빈 자리 오른쪽 클릭 · 층 단추 옆 「+」(읽기만 층 = 숨김) · 빈 나무 안내글 맞춤
- 찾기 칸 하나 — 띄어쓰기 낱말 모두(AND · 대소문자 무시) · 이름 · 키 · 경로(구분 · 상세구분) · 단위 · 공용 matchText 를 나무 · 일위대가 조합 목록이 함께 씀(목록의 따로 찾기 칸 없앰)
- 시험 — 찾기 AND · 새 배치 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 18:15:43 +09:00

64 lines
2.7 KiB
JavaScript

/* M02 구조물 라이브러리 자료(`M02_MasterTemplete_TreePanel_Model.ts`) 단위검증 헬퍼 — 트랜스파일해 Node 로 돌리고 JSON 으로 냄. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const file = path.join(__dirname, "..", "..", "M02_MasterTemplete", "M02_MasterTemplete_TreePanel_Model.ts");
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
new Function("exports", "module", "require", js)(box.exports, box, require);
const m = box.exports;
const item = (열, 경로, key) => ({ key, 열, 경로, 이름: 경로.join(" "), 단위: "m", 일위대가: null });
const view = {
판: "v1",
폴더: [["빈 폴더"], ["돌기슭막이", "빈 아래"]],
items: [
item("c1", ["돌기슭막이", "메쌓기", "1.2m"], "SS000001"),
item("c2", ["돌기슭막이", "찰쌓기"], "SS000002"),
item("c3", ["다섯", "둘", "셋", "넷", "잎"], "SS000003"),
item("c4", ["최상위 항목"], "SS000004"),
],
};
const shape = (n) => ({
path: n.path,
items: n.items.map((i) => i.열),
folders: n.folders.map(shape),
});
const all = m.buildFolders(view);
const found = m.buildFolders(view, "찰쌓기");
process.stdout.write(
JSON.stringify({
all: shape(all),
count: m.countItems(all),
found: shape(found),
foundCount: m.countItems(found),
none: shape(m.buildFolders(view, "없는말")),
folders: m.listFolders(all),
ancestors: m.ancestorsOf(view, "c3"),
ancestorsTop: m.ancestorsOf(view, "c4"),
ancestorsNone: m.ancestorsOf(view, "zz"),
under: [
m.isUnder(["a", "b"], ["a"]),
m.isUnder(["a"], ["a"]),
m.isUnder(["a"], ["a", "b"]),
m.isUnder(["x"], ["a"]),
],
leaf: m.leafName(view.items[0]),
dir: m.folderOf(view.items[0]),
byKey: m.buildFolders(view, "ss000003").items.length + m.buildFolders(view, "SS000003").folders.length,
// 찾기 AND(PLAN 29-6) — 낱말 모두 · 대소문자 무시 · 순서 무관 · 빈 글 = 참
and: [
m.matchText(["돌기슭막이", "메쌓기", "SS000001", "m"], "메쌓기 ss000001"),
m.matchText(["돌기슭막이", "메쌓기", "SS000001", "m"], "ss000001 돌기슭"),
m.matchText(["돌기슭막이", "메쌓기", "SS000001", "m"], "메쌓기 찰쌓기"),
m.matchText(["UC3-000001", "브레인 측구", null, "배수"], ""),
m.matchText(["UC3-000001", "브레인 측구", null, "배수"], "측구 배수"),
],
andTree: m.countItems(m.buildFolders(view, "돌기슭막이 찰쌓기")),
}),
);