summaryrefslogtreecommitdiff
path: root/internal/handlers/widget_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-08-13 08:38:29 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-08-13 08:38:29 +0000
commita03d7673e7adf9a575c7272b2b528a74b230535e (patch)
treea4ac635d92eade4df117db2a4fbdfe1eff13d677 /internal/handlers/widget_test.go
parent2509dde6aa372a505b186657706f4d21bd391807 (diff)
Fix blank task-detail modal for Google Tasks
loadTaskDetailData/HandleUpdateTask only had cases for "trello" and "doot" sources, so opening a gtask from the Tasks or Timeline tab rendered an empty title/description. Reuses the existing findGoogleTask cache lookup for both. Renamed the API client's UpdateTaskNotes to UpdateTask(title, notes) so the web modal can save an edited title too, not just description; the widget's description-only edit popup now just round-trips the task's existing title unchanged.
Diffstat (limited to 'internal/handlers/widget_test.go')
-rw-r--r--internal/handlers/widget_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/handlers/widget_test.go b/internal/handlers/widget_test.go
index 2bb92bc..fcbba52 100644
--- a/internal/handlers/widget_test.go
+++ b/internal/handlers/widget_test.go
@@ -17,6 +17,7 @@ import (
type mockGoogleTasksClient struct {
completedListID, completedTaskID string
notesListID, notesTaskID, notes string
+ notesTitle string
}
func (m *mockGoogleTasksClient) GetTasks(ctx context.Context) ([]models.GoogleTask, error) {
@@ -32,8 +33,8 @@ func (m *mockGoogleTasksClient) CompleteTask(ctx context.Context, listID, taskID
func (m *mockGoogleTasksClient) UncompleteTask(ctx context.Context, listID, taskID string) error {
return nil
}
-func (m *mockGoogleTasksClient) UpdateTaskNotes(ctx context.Context, listID, taskID, notes string) error {
- m.notesListID, m.notesTaskID, m.notes = listID, taskID, notes
+func (m *mockGoogleTasksClient) UpdateTask(ctx context.Context, listID, taskID, title, notes string) error {
+ m.notesListID, m.notesTaskID, m.notesTitle, m.notes = listID, taskID, title, notes
return nil
}
func (m *mockGoogleTasksClient) GetTaskLists(ctx context.Context) ([]models.TaskListInfo, error) {
@@ -678,6 +679,9 @@ func TestHandleWidgetUpdate_GoogleTask(t *testing.T) {
if mock.notesListID != "list-a" || mock.notesTaskID != "g1" || mock.notes != "bring photo and $170" {
t.Errorf("unexpected update call: listID=%q taskID=%q notes=%q", mock.notesListID, mock.notesTaskID, mock.notes)
}
+ if mock.notesTitle != "Renew passport" {
+ t.Errorf("title = %q, want unchanged %q (widget's edit popup has no title field)", mock.notesTitle, "Renew passport")
+ }
}
func seedTestCard(t *testing.T, db *store.Store) {