"""모달 위 고정 · 「더하기」 → 「추가」(PLAN 30-1) — 화면 판정은 ORCA. · 찾기 있는 모달은 세로 가운데 대신 위에서 고정 거리(목록 길이가 바뀌어도 찾기 칸이 안 움직임) · 보이는 글에 「더하기」 없음(주석 · 안쪽 명령 이름 `시트더하기` 는 뺌) """ from __future__ import annotations import re import subprocess from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def _text(rel: str) -> str: return (ROOT / rel).read_text(encoding="utf-8") def _block(css: str, selector: str) -> str: found = re.search(rf"^{re.escape(selector)} \{{([^}}]*)\}}", css, re.M) assert found, selector return found.group(1) def test_공용_모달_위_고정(): css = _text("ui_template/ui_template_modal.css") assert "align-items: flex-start;" in _block(css, ".ui-modal__backdrop") modal = _block(css, ".ui-modal") assert "max-height: var(--modal-max, 80vh);" in modal assert "margin-top: calc((100dvh - var(--modal-max, 80vh)) / 2);" in modal # 큰 창은 max-height 대신 --modal-max(위 거리가 함께 맞음) # 고르기 창 = 공용 큰 창 곁값(147-2) assert "--modal-max: 94vh;" in _block(css, ".ui-modal.ui-modal--wide") assert "wide: true," in _text("ui_template/ui_template_item_picker.ts") assert "--modal-max: 92vh;" in _block( _text("B05_Profile/B05_Profile_UI_Style_RouteRecommend.css"), ".ui-modal.b05-routerec" ) assert "margin-top: 0;" in _block( _text("M02_MasterTemplete/M02_MasterTemplete_Drawing.css"), ".m02-pop > .ui-modal" ) def test_따로_둔_모달도_위_고정(): logic = _text("M01_MasterData/M01_MasterData_UI_Logic_Style.css") assert "align-items: flex-start;" in _block(logic, ".m01-logic__backdrop") assert "margin-top: calc((100dvh - var(--modal-max, 80vh)) / 2);" in _block( logic, ".m01-logic__pick" ) assert "--modal-max: 90vh;" in _block( _text("M01_MasterData/M01_MasterData_UI_LogicLab_Style.css"), ".m01copy__sheet" ) m01 = _text("M01_MasterData/M01_MasterData_UI_Style.css") assert "align-items: flex-start;" in _block(m01, ".m01-procure") assert "margin-top: 10vh;" in _block(m01, ".m01-procure__box") b01 = _text("B01_Dashboard/B01_Dashboard_UI_Style.css") + _text( "B01_Dashboard/B01_Dashboard_UI_Style_Company.css" ) assert "align-items: flex-start;" in _block(b01, ".b01-dashboard__modal") def test_보이는_글에_더하기_없음(): files = subprocess.run( ["git", "ls-files", "*.ts"], cwd=ROOT, capture_output=True, text=True, encoding="utf-8" ).stdout.split() left = [] for rel in files: if rel.startswith(("tmp/", "docs/", "resources/")): continue for no, line in enumerate(_text(rel).splitlines(), 1): if line.strip().startswith(("//", "*", "/*")): continue for m in re.finditer(r"([\"'`])((?:(?!\1).)*더하기(?:(?!\1).)*)\1", line): if m.group(2) != "시트더하기": # 안쪽 명령 이름 — 화면에 안 나옴 left.append(f"{rel}:{no}: {m.group(2)}") assert not left, left