package server import ( "net/http" "net/http/httptest" "testing" ) func TestDashboard_EscapeClosesOverlay(t *testing.T) { srv := setupTestServer(t) req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Router.ServeHTTP(w, req) body := w.Body.String() if !containsStr(body, "Escape") { t.Error("expected Escape key handler for overlay") } } func TestDashboard_BackdropClickClosesOverlay(t *testing.T) { srv := setupTestServer(t) req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Router.ServeHTTP(w, req) body := w.Body.String() if !containsStr(body, "e.target === this") { t.Error("expected backdrop click handler for overlay") } } func TestTaskDetail_HasInnerWrapper(t *testing.T) { srv := setupTestServer(t) req := httptest.NewRequest(http.MethodGet, "/task/T01", nil) w := httptest.NewRecorder() srv.Router.ServeHTTP(w, req) body := w.Body.String() if !containsStr(body, "detail-inner") { t.Error("expected detail-inner wrapper in task detail") } } func TestTaskDetail_RendersMarkdownAsHTML(t *testing.T) { srv := setupTestServer(t) req := httptest.NewRequest(http.MethodGet, "/task/T01", nil) w := httptest.NewRecorder() srv.Router.ServeHTTP(w, req) body := w.Body.String() // Markdown headers should be rendered as HTML

tags if !containsStr(body, "

") { t.Error("expected rendered

from markdown heading") } // Should have docs-content class for proper styling if !containsStr(body, "docs-content") { t.Error("expected docs-content class on detail content") } } func TestDocsPage_HasFullHeightLayout(t *testing.T) { srv := setupTestServer(t) req := httptest.NewRequest(http.MethodGet, "/docs", nil) w := httptest.NewRecorder() srv.Router.ServeHTTP(w, req) body := w.Body.String() if !containsStr(body, "docs-container") { t.Error("expected docs-container class") } if !containsStr(body, "docs-layout") { t.Error("expected docs-layout class for grid layout") } }