test: make .send-btn / .app-titlebar global-selector finders skin-variant-aware (#3164 Neon uses :root.dark[data-skin=])
This commit is contained in:
@@ -681,7 +681,11 @@ def test_pwa_safe_area_top_stays_scoped_to_installed_modes():
|
||||
|
||||
def test_titlebar_safe_area_top_uses_scoped_variable():
|
||||
"""The titlebar must use the safe-area variable instead of direct env()."""
|
||||
m = re.search(r'\.app-titlebar\{(?P<body>[^}]*)\}', CSS)
|
||||
# Match the GLOBAL `.app-titlebar{...}` rule, not skin-scoped variants like
|
||||
# `:root.dark[data-skin="neon"] .app-titlebar{...}` (#3164) which can appear
|
||||
# earlier in the file. Require the selector to start the line (optionally
|
||||
# indented) with no `[data-skin=` scope prefix.
|
||||
m = re.search(r'(?m)^\s*\.app-titlebar\{(?P<body>[^}]*)\}', CSS)
|
||||
assert m, ".app-titlebar rule missing from style.css"
|
||||
rule = m.group("body")
|
||||
assert "padding-top:var(--app-titlebar-safe-top)" in rule, (
|
||||
|
||||
@@ -31,7 +31,10 @@ def _find_global_selector(css, selector):
|
||||
return -1
|
||||
line_start = css.rfind('\n', 0, idx) + 1
|
||||
line_prefix = css[line_start:idx]
|
||||
if ':root[data-skin=' not in line_prefix:
|
||||
# Skip skin-scoped rules. Skins use both `:root[data-skin="x"]` and the
|
||||
# dark-variant `:root.dark[data-skin="x"]` (#3164 Neon), so match the
|
||||
# `[data-skin=` marker generically rather than the bare `:root[` form.
|
||||
if '[data-skin=' not in line_prefix:
|
||||
return idx
|
||||
pos = idx + 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user