summaryrefslogtreecommitdiff
path: root/internal/handlers/buckets_web_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-08-07 10:39:28 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-08-07 10:39:28 +0000
commiteadd17df2946a1219fdf02f2ee0a0ac19734e56d (patch)
treee0460d1cdd9c17fd47ce7cce2fe7845378d8011e /internal/handlers/buckets_web_test.go
parent06450fe69ade2928deb9274bb67b7ba60d394b4f (diff)
Wire the Tasks tab into nav; fold in buckets/projects/labels and recurrence
The Tasks tab (/tabs/tasks) existed server-side and was tested, but nothing in the nav linked to it -- it was pure dead weight in the other direction. Wiring it up as the natural home for everything that was either misplaced in Settings or missing a web UI entirely: - Maintenance Buckets, Projects, and Labels moved out of Settings and into the Tasks tab (restyled from Settings' opaque slate cards to the glass/backdrop-blur look already used by the tab's chain/atom cards -- they're now embedded in index.html's page shell, not a standalone page, so the shared bg-card/bg-input classes from that shell apply). Settings keeps only what's actually settings: Passkeys, Trusted Agents, Data Sources. - Added a Recurrence section to the task-detail modal (freq/interval/ weekday form, posting to a new POST /tasks/recurrence -- the HTMX counterpart to the widget API's HandleWidgetTaskRecurrence). Native task recurrence previously had zero web UI at all, only reachable via the Android widget's RecurrenceEditDialog. Also fixed a real bug found while touching this code: HandleGetTaskDetail's source switch only had a case for "trello" -- opening any native ("doot") task's detail modal, which is most tasks in this tab, showed a blank title and description. Factored both call sites (initial GET and the re-render after a recurrence edit) through one loadTaskDetailData helper and added the missing "doot" case. Also fixed task-detail.html's styling, which was still using pre-dark-theme classes (text-gray-900 etc.) -- functionally invisible text on the modal's dark background. Verified with a throwaway local server (real templates + real DB, not the MockRenderer the unit tests use) seeded with a recurring task, a bucket, a project, and a label -- confirmed all five touched routes render 200 with the expected content, including the populated Buckets/Projects/Labels sections and a real weekly-recurrence form with the correct weekdays pre-checked. Caught and fixed a copy bug this way too ("every 2 weeklys" -> "every 2 weeks"). Not committed; deleted after use. go build ./..., go vet ./..., and go test ./... all clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ7ikw2ukGJFTHE3bJS7zL
Diffstat (limited to 'internal/handlers/buckets_web_test.go')
-rw-r--r--internal/handlers/buckets_web_test.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/internal/handlers/buckets_web_test.go b/internal/handlers/buckets_web_test.go
index befdc01..b29e842 100644
--- a/internal/handlers/buckets_web_test.go
+++ b/internal/handlers/buckets_web_test.go
@@ -7,7 +7,6 @@ import (
"testing"
"task-dashboard/internal/models"
- "task-dashboard/internal/store"
)
func TestHandleBucketsCreate_Web_CreatesBucket(t *testing.T) {
@@ -143,7 +142,7 @@ func TestHandleBucketDelete_Web_RemovesBucket(t *testing.T) {
}
}
-func TestHandleSettingsPage_IncludesBucketsProjectsLabels(t *testing.T) {
+func TestHandleTabTasks_IncludesBucketsProjectsLabels(t *testing.T) {
h, cleanup := setupTestHandler(t)
defer cleanup()
if _, err := h.store.CreateBucket("Gutters", 30, 1); err != nil {
@@ -156,9 +155,9 @@ func TestHandleSettingsPage_IncludesBucketsProjectsLabels(t *testing.T) {
t.Fatal(err)
}
- req := httptest.NewRequest("GET", "/settings", nil)
+ req := httptest.NewRequest("GET", "/tabs/tasks", nil)
w := httptest.NewRecorder()
- h.HandleSettingsPage(w, req)
+ h.HandleTabTasks(w, req)
if w.Code != http.StatusOK {
t.Fatalf("status = %d, want 200, body=%s", w.Code, w.Body.String())
@@ -167,15 +166,14 @@ func TestHandleSettingsPage_IncludesBucketsProjectsLabels(t *testing.T) {
mock := h.renderer.(*MockRenderer)
lastCall := mock.Calls[len(mock.Calls)-1]
data, ok := lastCall.Data.(struct {
- Configs map[string][]models.SourceConfig
- Sources []string
- SyncLog []store.SyncLogEntry
- Agents []models.Agent
- Buckets []models.BucketSummary
- Projects []models.Project
- Labels []models.LabelColor
- CSRFToken string
- WebAuthnEnabled bool
+ Atoms []models.Atom
+ FutureAtoms []models.Atom
+ Boards []models.Board
+ Chains []models.ChainSummary
+ Buckets []models.BucketSummary
+ Projects []models.Project
+ Labels []models.LabelColor
+ Today string
})
if !ok {
t.Fatalf("unexpected data type %T", lastCall.Data)