23 lines
787 B
Python
23 lines
787 B
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
|