- integration/ui-kit.ts: document 없을 때 injectBaseStyles 안 부름(vitest ime-sink 깨짐) · ui_template_list_row.css 실음(블록 이름 줄 = ui-sidebar-row) - 블록 라이브러리 [파일로 내보내기] [파일에서 가져오기] = 글 12 로 한 줄에 둘이 안 들어가 줄을 넘김(글 자르지 않음) - resources/tester/test_553_6_cad_parts.py: 부품 클래스 · 확인창(window.confirm · prompt 0) · 부품 CSS 먼저 · 날 색 · 보라 별칭 · 옛 자체 단추 규칙 없음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
2.8 KiB
Python
74 lines
2.8 KiB
Python
"""553-6 CAD 앱 겉 = 부품 상자 부품 — 화면 없이 소스로 지킴.
|
|
|
|
상태막대 켜기 칩 · 특성/레이어 탭 · 떠 있는 판 · 메뉴 · 아이콘 단추 · 확인창(window.confirm · prompt 없음) ·
|
|
부품 CSS 를 앱 CSS 보다 먼저 실음 · 옛 자체 단추 규칙 · 보라 별칭 · 날 색 없음 · 도면 바탕 = --draw-canvas.
|
|
"""
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
CAD = ROOT / "B07_DesignDetail" / "openwebcad" / "src"
|
|
|
|
|
|
def _t(rel: str) -> str:
|
|
return (CAD / rel).read_text("utf-8")
|
|
|
|
|
|
def test_parts_markup():
|
|
status = _t("components/StatusBar.tsx")
|
|
assert status.count('className="ui-toggle ui-toggle--chip"') == 6
|
|
assert 'data-size="22"' in status and "aria-pressed=" in status
|
|
inspector = _t("components/InspectorPanel.tsx")
|
|
assert '"ui-tabs cad-inspector-tabs"' in inspector and inspector.count("ui-tabs__tab") == 2
|
|
for rel in (
|
|
"components/QuickProperties.tsx",
|
|
"components/BlockLibraryPanel.tsx",
|
|
"components/FramePlaceholderPanel.tsx",
|
|
):
|
|
src = _t(rel)
|
|
assert (
|
|
"ui-float-panel" in src
|
|
and "ui-float-panel__head" in src
|
|
and "ui-float-panel__body" in src
|
|
), rel
|
|
assert "ui-ctx-menu cad-ribbon-overflow" in _t("ribbon/Ribbon.tsx")
|
|
assert "ui-ctx-menu cad-command-suggestions" in _t("components/CommandLine.tsx")
|
|
assert "ui-ctx-menu cad-snap-menu" in _t("inputController/snap-menu.ts")
|
|
assert _t("components/ViewControls.tsx").count("{...ICON_BUTTON}") == 5
|
|
assert "ui-icon-btn" in _t("components/QuickAccessBar.tsx")
|
|
assert "h-[42px]" in _t("components/Button.tsx")
|
|
|
|
|
|
def test_no_system_dialogs():
|
|
for path in CAD.rglob("*.ts*"):
|
|
if ".test." in path.name:
|
|
continue
|
|
src = path.read_text("utf-8")
|
|
assert "window.confirm(" not in src and "window.prompt(" not in src, path.name
|
|
assert "askConfirm" in _t("components/BlockLibraryPanel.tsx")
|
|
assert "askText" in _t("commands/commands.insert.ts")
|
|
|
|
|
|
def test_kit_loaded_before_app_css():
|
|
kit = _t("integration/ui-kit.ts")
|
|
assert "if (typeof document !== 'undefined') injectBaseStyles();" in kit
|
|
main = _t("main.tsx")
|
|
assert main.index("./integration/ui-kit.ts") < main.index("import App from './App.tsx'")
|
|
|
|
|
|
def test_css_tokens_only():
|
|
css = _t("App.css") + _t("App_Layers.css") + _t("inputController/snap-menu.css")
|
|
assert "--cad-canvas: var(--draw-canvas);" in css
|
|
assert "mist-violet" not in css
|
|
assert not re.search(r"#[0-9a-fA-F]{3,6}\b", css)
|
|
# 옛 자체 단추 규칙은 부품이 대신함
|
|
for gone in (
|
|
".cad-statusbar button",
|
|
".cad-view-controls button",
|
|
".cad-quick-properties__header",
|
|
".cad-frame-tokens__button",
|
|
".cad-inspector-tabs button",
|
|
):
|
|
assert gone not in css, gone
|