91 lines
3.7 KiB
Python
91 lines
3.7 KiB
Python
"""BUG-118 — barre d'apps commune en mobile (Fusion ACC-1, #215).
|
|
|
|
Retours de Bruno (2026-10-21) sur téléphone : la barre débordait
|
|
(pastilles domaines et onglets entiers affichés) et son bouton ☰
|
|
ne faisait rien — il cliquait le bouton bureau
|
|
``sidebar-toggle-btn`` au lieu du vrai hamburger mobile
|
|
``hamburger-btn``. Correctifs verrouillés ici : CSS commune v0.1.2
|
|
(palier 700 px resserré selon la spec) et rail contextuel dans
|
|
index.html (mobile ≤ 768 px → hamburger-btn).
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
FRONTEND = Path(__file__).resolve().parent.parent / "frontend"
|
|
|
|
|
|
def _css() -> str:
|
|
return (FRONTEND / "draco-barre.css").read_text(encoding="utf-8")
|
|
|
|
|
|
def _index() -> str:
|
|
return (FRONTEND / "index.html").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_palier_mobile_resserre_v012():
|
|
css = _css()
|
|
assert "@media (max-width: 900px)" in css
|
|
# Seul l'onglet de l'app courante reste visible en mobile.
|
|
assert '.draco-bar[data-current="obsigate"] .draco-apptab[data-app="obsigate"]' in css
|
|
# Domaines et boutons icônes (rail, menu) masqués en mobile.
|
|
bloc = css.split("@media (max-width: 900px)", 1)[1]
|
|
assert ".draco-domaines" in bloc
|
|
assert "display: none" in bloc
|
|
|
|
|
|
def test_menu_des_applications_par_la_marque():
|
|
# v0.1.3 : la marque ✦ ouvre le menu des 4 applications
|
|
# (changement d'app en mobile), logo à 24 px.
|
|
html = _index()
|
|
assert 'data-act="apps"' in html
|
|
js = (FRONTEND / "draco-barre.js").read_text(encoding="utf-8")
|
|
assert "draco-apps-menu" in js
|
|
assert "font-size: 24px" in _css()
|
|
|
|
|
|
def test_panneau_spark_integre_218():
|
|
# #218 : le bouton Spark de la barre ouvre le panneau de l'agent
|
|
# commun (mêmes assets partagés que TikTak / Flowdeck / Kanbante).
|
|
html = _index()
|
|
assert (FRONTEND / "draco-panneau.js").is_file()
|
|
assert (FRONTEND / "draco-panneau.css").is_file()
|
|
assert '<link rel="stylesheet" href="/static/draco-panneau.css" />' in html
|
|
assert '<script defer src="/static/draco-panneau.js"></script>' in html
|
|
# L'action spark bascule sur le panneau — plus le message d'attente.
|
|
assert "window.DRACO_PANNEAU.toggle()" in html
|
|
assert "arrive en phase 4 du programme Fusion" not in html
|
|
panneau = (FRONTEND / "draco-panneau.js").read_text(encoding="utf-8")
|
|
assert "https://agent.dracodev.net" in panneau
|
|
|
|
|
|
def test_panneau_bouton_console_221():
|
|
# #221 : le panneau Spark (asset vendangé, octet-identique dans
|
|
# les 4 apps) porte un bouton « Console ↗ » qui ouvre la console
|
|
# web du service dans un nouvel onglet, sur la discussion
|
|
# courante (?disc=) et avec l'app d'origine (?app= déduite du
|
|
# sous-domaine : og → obsigate).
|
|
panneau = (FRONTEND / "draco-panneau.js").read_text(encoding="utf-8")
|
|
assert 'data-disc="console"' in panneau
|
|
assert "Console ↗" in panneau
|
|
assert "ouvrirConsole" in panneau
|
|
assert '"disc=" + encodeURIComponent(id)' in panneau
|
|
assert '"app=" + encodeURIComponent(app)' in panneau
|
|
assert 'og: "obsigate"' in panneau
|
|
assert 'window.open(API + "/"' in panneau
|
|
assert '"_blank", "noopener"' in panneau
|
|
|
|
|
|
def test_csp_ouvre_le_service_d_agents_218():
|
|
# Le panneau parle au service d'agents : la CSP doit nommer son
|
|
# hôte en connect-src, sans ouvrir de générique supplémentaire.
|
|
main = (Path(__file__).resolve().parent.parent / "backend" / "main.py").read_text(encoding="utf-8")
|
|
ligne = next(l for l in main.splitlines() if "connect-src" in l)
|
|
assert "https://agent.dracodev.net" in ligne
|
|
|
|
|
|
def test_rail_mobile_vers_le_vrai_hamburger():
|
|
html = _index()
|
|
assert 'matchMedia("(max-width: 768px)")' in html
|
|
assert '"hamburger-btn"' in html
|
|
assert '"sidebar-toggle-btn"' in html
|