Merge remote-tracking branch 'origin/sub_laptop_6' into main_laptop_1
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
"""552-6 부품 흠 둘 지킴 시험 — 화면 실측은 Playwright · ORCA(부품 모음 · M01 · M02 · B06 모달).
|
||||
|
||||
① [hidden] — 부품 CSS 마다 display 를 주는 ui-* 클래스는 숨김 규칙(!important)이 같은 파일에 있음
|
||||
(공용 기본 꼴 `[hidden]` 이 안 실린 곳 · 페이지 꾸밈 위에서도 숨김이 이김)
|
||||
② 모달 머리 — 긴 제목 = 한 줄 말줄임 · [닫기] · 머리 단추는 안 줄고 안 꺾임
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
UI = Path(__file__).resolve().parents[2] / "ui_template"
|
||||
SKIP = {"ui_template_theme.css", "ui_template_ui_kit.css"} # 공통 값 · 부품 모음 화면 자체
|
||||
STATE = re.compile(r":(hover|focus|active|checked|disabled)|\[data-|\[aria-|:not")
|
||||
|
||||
|
||||
def _css(path: Path) -> str:
|
||||
s = re.sub(r"/\*.*?\*/", "", path.read_text(encoding="utf-8"), flags=re.S)
|
||||
return re.sub(r"@[^{;]+\{", "", s) # @media 겉 떼어 냄
|
||||
|
||||
|
||||
def _missing(path: Path) -> list[str]:
|
||||
hidden, shown = set(), set()
|
||||
for sel, body in re.findall(r"([^{}]+)\{([^{}]*)\}", _css(path)):
|
||||
if "[hidden]" in sel:
|
||||
if "!important" in body:
|
||||
hidden.update(re.findall(r"\.(ui-[\w-]+)", sel))
|
||||
continue
|
||||
m = re.search(r"(?<![\w-])display\s*:\s*([\w-]+)", body)
|
||||
if not m or m.group(1) == "none":
|
||||
continue
|
||||
for one in sel.split(","):
|
||||
last = re.split(r"[\s>+~]+", one.strip())[-1]
|
||||
if not STATE.search(last):
|
||||
shown.update(re.findall(r"\.(ui-[\w-]+)", last))
|
||||
return sorted(shown - hidden)
|
||||
|
||||
|
||||
def test_숨김이_부품_display_를_이김():
|
||||
miss = {p.name: _missing(p) for p in sorted(UI.glob("*.css")) if p.name not in SKIP}
|
||||
assert {k: v for k, v in miss.items() if v} == {}
|
||||
# 접이 카드 머리 = theme.css 의 display → 숨김은 접이 카드 파일에
|
||||
assert ".ui-collapsible__title[hidden]" in (UI / "ui_template_collapsible.css").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
def test_모달_머리_닫기_한_줄():
|
||||
css = (UI / "ui_template_modal.css").read_text(encoding="utf-8")
|
||||
h3 = re.search(r"\.ui-modal__top > h3 \{([^}]*)\}", css).group(1)
|
||||
for d in (
|
||||
"min-width: 0;",
|
||||
"overflow: hidden;",
|
||||
"text-overflow: ellipsis;",
|
||||
"white-space: nowrap;",
|
||||
):
|
||||
assert d in h3
|
||||
assert "flex: none;" in re.search(r"\.ui-modal__top > :not\(h3\) \{([^}]*)\}", css).group(1)
|
||||
assert re.search(r"\.ui-modal__top > button,[^{]*\{[^}]*white-space: nowrap;", css)
|
||||
ts = (UI / "ui_template_modal.ts").read_text(encoding="utf-8")
|
||||
assert (
|
||||
'el("h3", { text: opts.title, attrs: { title: opts.title } })' in ts
|
||||
) # 말줄임 = 전체 글은 title
|
||||
Reference in New Issue
Block a user