Files
Hulumath-Web/backend/common/test_frontend_assets.py
T
Jacky c365454395
CI / test (pull_request) Canceled after 34s
PR合并自动部署 / release-check (pull_request) Successful in 1m35s
PR合并自动部署 / deploy (pull_request) Successful in 10s
fix: keep admin theme contrast consistent
2026-08-09 00:34:31 +08:00

37 lines
1.2 KiB
Python

from pathlib import Path
from django.conf import settings
STATIC_ROOT = Path(settings.BASE_DIR) / "static"
def test_app_js_幂等键兼容非安全上下文():
source = (STATIC_ROOT / "js" / "app.js").read_text(encoding="utf-8")
assert "function createIdempotencyKey()" in source
assert "crypto.randomUUID()" not in source
assert source.count('"Idempotency-Key": createIdempotencyKey()') == 2
def test_app_css_答题提交按钮可见且长弹窗可滚动():
source = (STATIC_ROOT / "css" / "app.css").read_text(encoding="utf-8")
assert ".choice-list .primary-button" in source
assert "background: var(--green); color: white; text-align: center" in source
assert "max-height: calc(100dvh - 30px)" in source
assert "overflow-y: auto" in source
def test_admin_css_深色系统下仍保持完整浅色主题():
source = (STATIC_ROOT / "admin" / "css" / "hulumath_admin.css").read_text(
encoding="utf-8"
)
assert "color-scheme: light" in source
assert "--body-fg: #17211b" in source
assert "--body-bg: #f3f1e9" in source
assert "--darkened-bg: #ebeae3" in source
assert "background-color: #ffffff !important" in source
assert ".theme-toggle" in source
assert "display: none" in source