42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Palier 8 (0.11.0): navigation manuelle du Wallboard."""
|
|
|
|
from datetime import datetime, timezone
|
|
|
|
|
|
def _make_two_active_projects(fake_gitea):
|
|
"""The fake's second repo is 800 days old (inactive): revive it."""
|
|
now = datetime.now(timezone.utc)
|
|
for repo in fake_gitea.repos:
|
|
if repo["full_name"] == "Projets/vieux":
|
|
repo["updated_at"] = now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
|
|
|
|
def test_wall_nav_markup_with_multiple_slides(client, fake_gitea):
|
|
_make_two_active_projects(fake_gitea)
|
|
r = client.get("/wall")
|
|
assert r.status_code == 200
|
|
assert r.text.count("wall-slide") >= 2
|
|
assert 'id="wall-prev"' in r.text
|
|
assert 'id="wall-next"' in r.text
|
|
assert 'id="wall-dots"' in r.text
|
|
assert 'id="wall-paused"' in r.text
|
|
assert "1 / 2" in r.text and "2 / 2" in r.text
|
|
|
|
|
|
def test_wall_no_nav_with_single_slide(client, fake_gitea):
|
|
r = client.get("/wall")
|
|
assert r.status_code == 200
|
|
assert 'id="wall-prev"' not in r.text
|
|
|
|
|
|
def test_wall_js_contract():
|
|
js = open("static/js/wall.js", encoding="utf-8").read()
|
|
# Arrow navigation + hard pause + position persistence.
|
|
assert "ArrowRight" in js and "ArrowLeft" in js
|
|
assert "sessionStorage" in js
|
|
assert "MANUAL_PAUSE_MS" in js
|
|
# The live listener must use the NAMED gitea event (onmessage
|
|
# never fires for named SSE events — the 0.6.0 bug).
|
|
assert "addEventListener('gitea'" in js
|
|
assert "source.onmessage" not in js
|