Kanbante 0.46.1 — HUB-18 : thème commun, barre v0.5.0 + initialisation thème Hub dans nav.js (fusion #132)
CI / test (push) Failing after 2s
CI / test (pull_request) Failing after 3s

This commit is contained in:
Spark
2026-11-06 14:49:25 +00:00
parent 7c457db59f
commit 0a5d83737b
6 changed files with 221 additions and 2 deletions
+5 -1
View File
@@ -30,8 +30,12 @@ def _sha256(chemin):
def test_barre_css_js_verbatim_commons_v041():
# Remplacé en 0.46.1 : la re-vendange v0.5.0 (HUB-18, thème
# commun) supersède l'empreinte JS v0.4.1 — l'empreinte courante
# est verrouillée par tests/test_barre_v050.py. Le CSS, inchangé
# en v0.5.0, garde son empreinte v0.4.1 ; le JS a quitté la v0.4.1.
assert _sha256("static/css/draco-barre.css") == SHA256_CSS_V041
assert _sha256("static/js/draco-barre.js") == SHA256_JS_V041
assert _sha256("static/js/draco-barre.js") != SHA256_JS_V041
def test_js_icones_espace_de_noms_svg():
+46
View File
@@ -0,0 +1,46 @@
"""Barre commune v0.5.0 (HUB-18, fusion #132) — re-vendange 0.46.1.
- JS vendangé VERBATIM depuis dracodev-commons, branche
hub18-theme-commun (PR commons #12), ui/barre-apps/. Le CSS est
inchangé en v0.5.0 : il garde l'empreinte v0.4.1 (verrouillée
par tests/test_barre_v041.py).
- Thème commun : la barre apprend la préférence du Hub
(GET <hub>/api/profil/theme) et l'applique à l'ouverture ;
l'initialisation propre à Kanbante vit dans static/js/nav.js
(écouteur draco:theme → data-theme + resynchronisation du
bouton de bascule, sans écraser le choix local kanbante-theme).
"""
import hashlib
from pathlib import Path
R = Path(__file__).resolve().parents[1]
SHA256_JS_V050 = "384e2b0248a7c84d77fbb6eae6c25366828554162556a6b5b19c96e188ce11c7"
def _sha256(chemin):
return hashlib.sha256((R / chemin).read_bytes()).hexdigest()
def test_barre_js_verbatim_commons_v050():
assert _sha256("static/js/draco-barre.js") == SHA256_JS_V050
def test_js_theme_commun_hub18():
js = (R / "static/js/draco-barre.js").read_text(encoding="utf-8")
assert "api/profil/theme" in js
assert 'credentials: "include"' in js
assert "draco-theme-hub" in js
assert 'CustomEvent("draco:theme"' in js
assert "themePref" in js and "themeMode" in js
assert "resolvedUrls.hub" in js
# Comportements conservés (v0.4.1) : icônes en espace de noms SVG.
assert 'createElementNS(SVG_NS, "svg")' in js
def test_nav_js_init_theme_hub():
nav = (R / "static/js/nav.js").read_text(encoding="utf-8")
assert 'addEventListener(\'draco:theme\'' in nav or 'addEventListener("draco:theme"' in nav
assert "appliquerThemeCommun" in nav
assert "syncThemeBtn(mode)" in nav
assert "DRACO_BAR" in nav and "themeMode" in nav