summaryrefslogtreecommitdiff
path: root/internal/handlers/widget_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-13 18:03:12 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-16 02:42:31 +0000
commit8e56555adb7d3c77f2da62288cbf484f7102a74a (patch)
tree0496a46d2a134f504dad8817c275521fa34538f7 /internal/handlers/widget_test.go
parentc901a6ea512088991bb2b2d5d1daebb5d90e000e (diff)
fix(widget): forward End for all-day multi-day calendar events
A genuine all-day Google Calendar event spanning multiple days (e.g. a 3-day conference) never got its EndTime forwarded to the widget client, since the conversion only set End when !IsAllDay. The client has no way to detect a multi-day span without both Start and End.
Diffstat (limited to 'internal/handlers/widget_test.go')
-rw-r--r--internal/handlers/widget_test.go33
1 files changed, 31 insertions, 2 deletions
diff --git a/internal/handlers/widget_test.go b/internal/handlers/widget_test.go
index 4e08d2a..2a6967e 100644
--- a/internal/handlers/widget_test.go
+++ b/internal/handlers/widget_test.go
@@ -174,8 +174,9 @@ func TestTimelineItemToWidgetItem_Event(t *testing.T) {
// IsAllDay item regardless of type, which meant the widget client's
// hourly-slot packer had no date information to pin all-day events to the
// top of the correct day and they could silently fall outside the visible
-// grid range instead. End stays nil since there's no meaningful end time to
-// show for an all-day item.
+// grid range instead. This fixture's End stays nil only because it has no
+// EndTime set -- see TestTimelineItemToWidgetItem_MultiDayAllDayEvent_ForwardsEnd
+// for the case where a multi-day all-day event has a real EndTime.
func TestTimelineItemToWidgetItem_AllDayEvent(t *testing.T) {
day := time.Date(2026, 7, 12, 0, 0, 0, 0, time.Local)
item := models.TimelineItem{
@@ -206,6 +207,34 @@ func TestTimelineItemToWidgetItem_AllDayEvent(t *testing.T) {
}
}
+// TestTimelineItemToWidgetItem_MultiDayAllDayEvent_ForwardsEnd proves that a
+// genuine all-day CALENDAR EVENT with a real EndTime (e.g. a 3-day
+// conference with no specific time) still gets End forwarded to the widget
+// client, even though IsAllDay is true -- needed so the client can detect
+// the multi-day span and render "starts"/"ends" labels per day.
+func TestTimelineItemToWidgetItem_MultiDayAllDayEvent_ForwardsEnd(t *testing.T) {
+ start := time.Date(2026, 7, 12, 0, 0, 0, 0, time.Local)
+ end := time.Date(2026, 7, 15, 0, 0, 0, 0, time.Local)
+ item := models.TimelineItem{
+ ID: "cal-conference",
+ Title: "Offsite",
+ Source: "calendar",
+ Type: models.TimelineItemTypeEvent,
+ Time: start,
+ EndTime: &end,
+ IsAllDay: true,
+ }
+
+ wi := TimelineItemToWidgetItem(item)
+
+ if wi.End == nil {
+ t.Fatal("expected End to be forwarded for a multi-day all-day event")
+ }
+ if !wi.End.Equal(end) {
+ t.Errorf("End = %v, want %v", *wi.End, end)
+ }
+}
+
// TestTimelineItemToWidgetItem_AllDayTask_KeepsFloatingBehavior proves the
// same fix does NOT change behavior for undated doot/gtask tasks, which are
// also flagged IsAllDay as a "no specific time" fallback (see