test(B05): 구조물 폼 요약 시험 헬퍼 — @util 별칭 · 가짜 요소 보탬 · 숨긴 길이 기대값 54-26 맞춤(230-3)

헬퍼가 @util/common_util_cross_structure_areas 를 못 찾던 것 — common_util 폴더로 별칭.
가짜 요소에 style.setProperty · select.options · Option 보탬.
숨긴 길이는 칸 없이 값만 쥠(54-26) — 기대값 맞추고 그린 칸 확인 추가 · 코드 안 고침.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3mdb91125mPoC6tpsQx4P
This commit is contained in:
2026-10-10 18:00:22 +09:00
co-authored by Claude Opus 5.5
parent 7e9563a2c9
commit 49f9dc73f8
2 changed files with 29 additions and 5 deletions
@@ -16,7 +16,11 @@ class FakeNode {
this.tagName = tag;
this.children = [];
this.dataset = {};
this.style = {};
this.style = {
setProperty(name, value) {
this[name] = value;
},
};
this.listeners = {};
this._text = "";
this._classes = new Set();
@@ -66,6 +70,10 @@ class FakeNode {
(this.listeners.click || []).forEach((h) => h({ target: this }));
}
scrollIntoView() {}
// 고르기 칸 보기(syncChoices) — 자식 중 option 만
get options() {
return this.children.filter((c) => c.tagName === "option");
}
// 시험에 필요한 두 가지 선택자만 — `[data-option-keys]` · `.클래스`
querySelectorAll(selector) {
const match = selector.startsWith("[")
@@ -82,6 +90,9 @@ class FakeNode {
}
}
globalThis.document = { createElement: (tag) => new FakeNode(tag) };
globalThis.Option = function Option(text, value) {
return Object.assign(new FakeNode("option"), { _text: text, value });
};
globalThis.Option = function Option(text, value) {
const node = new FakeNode("option");
node._text = String(text);
@@ -115,6 +126,10 @@ function loadTs(file) {
if (STUBS[request]) return STUBS[request];
// 화면 공용 부품(@ui/…) — 이 시험이 안 쓰는 것이라 뭘 불러도 아무 일 안 하는 함수로 막아 둠
if (request.startsWith("@ui/")) return new Proxy({}, { get: () => () => {} });
// 공용 계산(@util/…) — tsconfig 별칭대로 common_util 폴더에서 읽음
if (request.startsWith("@util/")) {
return loadTs(path.join(ROOT, "common_util", `${request.slice("@util/".length)}.ts`));
}
if (request.startsWith(".") && request.endsWith(".json")) {
return JSON.parse(fs.readFileSync(path.join(path.dirname(full), request), "utf8"));
}
@@ -297,7 +312,12 @@ const draw = (includeDetail) => {
},
{ height_m: 2 },
);
return { keys: optionInputs.map((e) => e.key), hidden: optionRow.hidden };
return {
keys: optionInputs.map((e) => e.key),
// 그린 칸 — 숨긴 길이(54-26)는 값만 쥐고 칸은 안 그림
drawn: optionRow.querySelectorAll("[data-option-keys]").map((e) => e.dataset.optionKeys),
hidden: optionRow.hidden,
};
};
out.drawB05 = draw(false); // B05 — 상세 칸 없음 + visible:false 숨김
out.drawB06 = draw(true); // B06 — 상세 칸까지, 단 visible:false 는 여기서도 숨김
@@ -36,11 +36,15 @@ def test_visible_false_만_숨김(out):
def test_visible_false_옵션은_폼에_안_그림_정의는_그대로(out):
# 숨긴 길이는 칸을 안 그리고 값만 쥠(54-26 · 범위 계산 · 저장이 옛 값을 이어 씀) · 상세는 B05 에 없음
assert out["drawB05"] == {
"keys": ["height_m"],
"keys": ["height_m", "length_m"],
"drawn": ["height_m"],
"hidden": False,
} # 길이 숨김 · 상세는 B05 에 없음
assert out["drawB06"]["keys"] == ["height_m", "stone_kind"] # B06 은 상세까지 · 숨김은 여기도
}
# B06 은 상세까지 · 숨김은 여기도 칸 없음
assert out["drawB06"]["drawn"] == ["height_m", "stone_kind"]
assert out["drawB06"]["keys"] == ["height_m", "stone_kind", "length_m"]
assert out["definitionKept"] == ["height_m", "length_m", "stone_kind", "back_len_cm"]