Files
sbnews/qa/frontend/test_worldcup_live_bottom_padding_static.py
T

49 lines
1.3 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
PANEL = ROOT / "uniapp" / "src" / "packages_match" / "components" / "WorldCupPanel.vue"
def extract_style_block(source: str, selector: str) -> str:
start = source.find(selector)
if start < 0:
raise AssertionError(f"missing selector: {selector}")
brace = source.find("{", start)
if brace < 0:
raise AssertionError(f"missing style body for: {selector}")
depth = 0
for pos in range(brace, len(source)):
char = source[pos]
if char == "{":
depth += 1
elif char == "}":
depth -= 1
if depth == 0:
return source[brace + 1:pos]
raise AssertionError(f"unterminated style body for: {selector}")
def main() -> int:
panel = PANEL.read_text(encoding="utf-8")
scroll_style = extract_style_block(panel, ".worldcup-scroll")
required_tokens = [
"140rpx",
"constant(safe-area-inset-bottom)",
"env(safe-area-inset-bottom)",
]
for token in required_tokens:
if token not in scroll_style:
raise AssertionError(f"{PANEL} .worldcup-scroll bottom padding should reserve tabbar space: {token}")
print("worldcup live bottom padding static checks passed")
return 0
if __name__ == "__main__":
raise SystemExit(main())