diff --git a/B05_Profile/B05_Profile_UI_Structures_Panel.ts b/B05_Profile/B05_Profile_UI_Structures_Panel.ts index e6342c6ee..03cf5124a 100644 --- a/B05_Profile/B05_Profile_UI_Structures_Panel.ts +++ b/B05_Profile/B05_Profile_UI_Structures_Panel.ts @@ -557,6 +557,14 @@ export function createStructuresSection( groupSelect.replaceChildren(new Option("— 선택 —", ""), ...groupOptions(next, pick)); groupSelect.value = ""; syncTypeOptions(); + // 늦게 온 종류 목록 = 고른 관 폼을 새 목록으로 다시 엶 — 고름만 남고 폼이 비던 흠(754-2) · + // 구조물 폼은 뒤따르는 `setStructures` 가 다시 엶 · 임시 배치 중 입력은 둠 + if (tempPipeChainage !== null) return; + const at = selectedPipeChainage; + const pipe = pipeFacilities.find( + (entry) => at !== null && Math.abs(entry.chainage_m - at) < PIPE_MATCH_M, + ); + if (pipe) loadPipeForm(pipe); }, setStructures(next) { // 서버 정본 주입 — onChange를 울리지 않는다. 울리면 Page가 다시 저장을 걸어 diff --git a/resources/tester/test_754_2_types_late_form.py b/resources/tester/test_754_2_types_late_form.py new file mode 100644 index 000000000..0f45c9c65 --- /dev/null +++ b/resources/tester/test_754_2_types_late_form.py @@ -0,0 +1,37 @@ +"""PLAN 754-2 — 구조물 종류 목록이 늦게 와도(`setTypes`) 고른 관 폼이 비지 않음. + +B05 · B06 한 폼(`B05_Profile_UI_Structures_Panel.ts`)을 두 보기가 따로 불러 `setTypes` 를 부름 — +종류 목록을 다시 세우며 군 · 종류를 빈칸으로 돌리므로, 고름이 남아 있으면 그 폼을 다시 열어야 함. +""" + +from __future__ import annotations + +import os +import re + +ROOT = os.path.join(os.path.dirname(__file__), "..", "..") + + +def _set_types_body() -> str: + path = os.path.join(ROOT, "B05_Profile", "B05_Profile_UI_Structures_Panel.ts") + with open(path, encoding="utf-8") as f: + src = f.read() + match = re.search( + r"\n setTypes\(next, pick = \(\) => true\) \{\n(.*?)\n \},\n", src, re.S + ) + assert match, "setTypes 본문을 못 찾음" + return match.group(1) + + +def test_종류를_다시_세운_뒤_고른_관_폼을_다시_엶() -> None: + body = _set_types_body() + reset = body.index("syncTypeOptions();") + assert body.index("loadPipeForm(pipe)", reset) > reset + assert "selectedPipeChainage" in body[reset:] + + +def test_임시_배치_중이면_폼을_다시_열지_않음() -> None: + """임시 배치(A군 우클릭 추가) 중 입력을 지우지 않게 — 옛 동작 그대로.""" + body = _set_types_body() + reset = body.index("syncTypeOptions();") + assert body.index("tempPipeChainage !== null", reset) < body.index("loadPipeForm(pipe)")