From 1d3794ba555ce59ccfc8658ffb971c8745db79c3 Mon Sep 17 00:00:00 2001 From: Spark Date: Sun, 11 Oct 2026 13:37:54 -0400 Subject: [PATCH] =?UTF-8?q?test(0.11.0):=20navigation=20wallboard=20(marku?= =?UTF-8?q?p=20multi-diapos,=20contrat=20JS)=20=E2=80=94=203=20tests,=2013?= =?UTF-8?q?6=20au=20total?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_palier8.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/test_palier8.py diff --git a/tests/test_palier8.py b/tests/test_palier8.py new file mode 100644 index 0000000..5cd1f0d --- /dev/null +++ b/tests/test_palier8.py @@ -0,0 +1,41 @@ +"""Palier 8 (0.11.0): navigation manuelle du Wallboard.""" + +from datetime import datetime, timedelta, 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