test(b05): 폼 소스 시험을 새 규칙에 맞춤 — 고르기 칸은 늘 빈 보기 · 기본값은 제안으로만(폼 ①②)

- 옛 「기본값 있는 칸은 첫 보기」(2026-08-17)를 확인하던 줄을 브레인 판정(2026-09-14)대로 뒤집음
- 칸 만들기가 `_Structures_Fields.optionControl` 로 옮겨간 자리를 봄

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
This commit is contained in:
2026-09-14 09:30:59 +09:00
co-authored by Claude Opus 5
parent fc2ecc0f39
commit 0a7f4a5008
2 changed files with 21 additions and 13 deletions
+15 -10
View File
@@ -24,6 +24,9 @@ if str(ROOT) not in sys.path:
from B08_Quantity.B08_Quantity_Engine_UnitQuantity import build_table # noqa: E402
PANEL = (ROOT / "B05_Profile" / "B05_Profile_UI_Structures_Panel.ts").read_text(encoding="utf-8")
#: 2026-09-14 칸 만들기가 `_Structures_Fields.optionControl` 로 옮겨감(브레인 판정 ①② — 고르기 칸은
#: 늘 빈 보기 · 기본값은 제안으로만).
FIELDS = (ROOT / "B05_Profile" / "B05_Profile_UI_Structures_Fields.ts").read_text(encoding="utf-8")
API = (ROOT / "B05_Profile" / "B05_Profile_Api_Structures.ts").read_text(encoding="utf-8")
COMMIT = (ROOT / "B05_Profile" / "B05_Profile_UI_Structures_Panel_Commit.ts").read_text(
encoding="utf-8"
@@ -39,22 +42,24 @@ def _registry_options(type_id: str) -> dict[str, dict]:
def test_폼이_empty_means_를_보고_빈_보기를_둔다() -> None:
"""소스 검사 — 빈 보기와 초기값이 **같은 판정**(`keepEmpty`)을 쓴다."""
assert "option.empty_means" in PANEL
assert "const keepEmpty = mustPick || meansEmpty;" in PANEL
assert 'if (keepEmpty) choices.unshift(["", mustPick ? "— 선택 —" : "— 안 정함 —"]);' in PANEL
# 빈 보기만 넣고 초기값을 첫 보기로 두면 화면은 「안 정함」인데 값은 첫 보기가 된다.
assert 'String(preset || (keepEmpty ? "" : (option.choices[0] ?? "")))' in PANEL
"""소스 검사 — 고르기 칸은 **늘** 빈 보기를 두고, 초기값은 저장된 값뿐(첫 보기를 안 박음)."""
assert "optionControl(option, values[option.key])" in PANEL
assert 'select([["", blank], ...option.choices' in FIELDS
# 초기값은 저장된 값만 — 첫 보기·기본값으로 채우지 않음.
assert "element.value = value;" in FIELDS
assert "option.choices[0]" not in PANEL
# 클라이언트 옵션 타입에 칸이 있어야 서버 응답의 `empty_means` 가 살아 온다.
assert "empty_means?: string | null;" in API
# 빈 칸은 아예 안 실린다 — 이 규칙이 있어야 「안 정함」이 정본에 안 박힌다.
assert "if (input.isEmpty()) return;" in COMMIT
def test_기본값_있는_칸_빈_보기를_안_둔() -> None:
"""`empty_means` 가 적혀 있어도 **기본값이 있으면** 그 값이 뜬다(2026-08-17 지시 유지)."""
def test_기본값_있는_칸_빈_보기에_제안으로만_보인() -> None:
"""⭐ 2026-09-14 브레인 판정으로 뒤집힘 — 기본값이 **있어도** 칸에 채우지 않고 빈 보기 이름에
「제안 …」으로만 보임(옛 2026-08-17 「첫 보기가 곧 기본값」 걷음). 저장 한 번에 기본값이
확정으로 굳던 뿌리였음."""
options = _registry_options("masonry_wet")
# 버림 콘크리트 — empty_means 가 있으나 기본이 「넣음」이다.
# 버림 콘크리트 — empty_means 가 있 기본이 「넣음」.
assert options["blinding_concrete"]["empty_means"]
assert options["blinding_concrete"]["default"] == "넣음"
# 채움 강도·야면석 계수 — 기본이 없어 빈 보기가 서야 하는 칸.
@@ -62,7 +67,7 @@ def test_기본값_있는_칸은_빈_보기를_안_둔다() -> None:
assert options[key]["empty_means"], key
assert options[key]["default"] is None, key
assert options[key]["required"] is False, key
assert '(option.default ?? "") === ""' in PANEL # 기본값 있으면 빈 보기를 안 둠
assert "`— 안 정함 (제안 ${suggested}) —`" in FIELDS
def _wall(**options) -> dict:
+6 -3
View File
@@ -39,10 +39,13 @@ def test_B05_는_종전대로_유무_종류_위치만():
def test_기본값_없는_필수_항목은_빈_칸으로_연다():
"""첫 항목을 슬쩍 고르면 **근거 없는 값**(뒷길이 25㎝ 같은)이 수량·단가로 흘러간다."""
panel = _PANEL.read_text(encoding="utf-8")
# 2026-09-13 — 빈 보기를 두는 까닭이 둘이 되어(필수 + `empty_means`) 한 줄로 합쳐졌다.
fields = (PROJECT_ROOT / "B05_Profile" / "B05_Profile_UI_Structures_Fields.ts").read_text(
encoding="utf-8"
)
# 2026-09-14 — 칸 만들기가 `optionControl` 로 옮겨감 · 고르기 칸은 **늘** 빈 보기(브레인 판정 ①).
# 필수 칸의 글자는 그대로 「— 선택 —」이다.
assert 'choices.unshift(["", mustPick ? "— 선택 —" : "— 안 정함 —"])' in panel
assert 'option.required === true && (option.default ?? "") === ""' in panel
assert "optionControl(option, values[option.key])" in panel
assert '? "— 선택 —"' in fields and 'select([["", blank]' in fields
def test_큰돌쌓기에_메_찰_구분이_있다():