Affiche le timer en cours dans le header

Pastille à droite du header sur toutes les pages (fragment
/ui/timer/entete) : description ou projet, chrono et bouton stop, bordée
à la couleur du projet. L'arrêt émet timer-changed pour rafraîchir le
timer de l'accueil (GET /ui/timer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-11-13 19:07:54 +01:00
1 parent cbc8ba8ce0
commit ef69462e06
7 files changed
+79 -2

No files matched your search

+32
View File
@@ -770,3 +770,35 @@ async fn project_repo_url() {
let (_, p) = send(&app, "GET", &format!("{uri}?archived=true"), None).await;
assert_eq!(p[0]["repo_url"], "https://git.example.com/x");
}
#[tokio::test]
async fn header_mini_timer() {
let app = app().await;
let p = project(&app, "Acme", "Site web").await;
let (status, html) = get_html(&app, "/ui/timer/entete").await;
assert_eq!(status, StatusCode::OK);
assert!(!html.contains("mini-timer-label"));
send(
&app,
"POST",
"/api/timer/start",
Some(json!({ "project_id": p, "note": "Refonte" })),
)
.await;
let (_, html) = get_html(&app, "/ui/timer/entete").await;
assert!(html.contains("Refonte") && html.contains("data-started"));
assert!(html.contains("hx-post=\"/ui/timer/stop\""));
// Without a note, the project name is shown.
send(
&app,
"POST",
"/api/timer/start",
Some(json!({ "project_id": p })),
)
.await;
let (_, html) = get_html(&app, "/ui/timer/entete").await;
assert!(html.contains("<span class=\"mini-timer-label\">Site web</span>"));
}