Permet de dupliquer une entrée
Bouton « Dupliquer » sur chaque ligne de /entries : ouvre sous l'entrée un formulaire prérempli (début, fin, projet, note) à ajuster avant de créer la copie. Une entrée en cours propose « maintenant » comme fin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d89d71fee0
commit
7c22567b07
4 files changed
+104
No files matched your search
@@ -618,3 +618,50 @@ async fn colors() {
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert!(html.contains("--color: #000000"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn duplicate_entry() {
|
||||
let app = app().await;
|
||||
let p = project(&app, "Acme", "Site web").await;
|
||||
let (status, _) = send(
|
||||
&app,
|
||||
"POST",
|
||||
"/api/entries",
|
||||
Some(json!({
|
||||
"project_id": p,
|
||||
"started_at": local(2026, 3, 10, 9, 0),
|
||||
"ended_at": local(2026, 3, 10, 10, 15),
|
||||
"note": "réunion",
|
||||
})),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::CREATED);
|
||||
|
||||
let (status, html) = get_html(&app, "/ui/entries/1/dupliquer").await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert!(html.contains("2026-03-10T09:00") && html.contains("2026-03-10T10:15"));
|
||||
assert!(html.contains("réunion"));
|
||||
|
||||
let (status, html) = send_form(
|
||||
&app,
|
||||
"/ui/entries/1/dupliquer",
|
||||
&format!("project_id={p}&started_at=2026-03-11T09%3A00&ended_at=2026-03-11T10%3A15¬e=r%C3%A9union"),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert!(html.contains("id=\"entry-2\"") && html.contains("mer. 11/03/2026"));
|
||||
|
||||
let (_, list) = send(
|
||||
&app,
|
||||
"GET",
|
||||
"/api/entries?from=2026-03-09&to=2026-03-15",
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
let list = list.as_array().unwrap();
|
||||
assert_eq!(list.len(), 2);
|
||||
assert!(list.iter().all(|e| e["note"] == "réunion"));
|
||||
|
||||
let (status, _) = get_html(&app, "/ui/entries/99/dupliquer").await;
|
||||
assert_eq!(status, StatusCode::NOT_FOUND);
|
||||
}
|
||||
Reference in new issue
Block a user