diff --git a/resources/tester/helper_b05_structures_form_summary.cjs b/resources/tester/helper_b05_structures_form_summary.cjs index 09c3e4f7c..1d65a9cc3 100644 --- a/resources/tester/helper_b05_structures_form_summary.cjs +++ b/resources/tester/helper_b05_structures_form_summary.cjs @@ -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 는 여기서도 숨김 diff --git a/resources/tester/test_b05_structures_form_summary.py b/resources/tester/test_b05_structures_form_summary.py index 22ad774a1..3fadfc00f 100644 --- a/resources/tester/test_b05_structures_form_summary.py +++ b/resources/tester/test_b05_structures_form_summary.py @@ -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"]