aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_data.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-18 15:29:35 +0200
committerDanilo M. <danix@danix.xyz>2026-10-18 15:29:35 +0200
commit48fa63ff5d0e12edf86db7f01def635aa0aaa9fb (patch)
tree28bdd13bf12cf51464b01975ee4e9eef08596f85 /test/test_data.lua
parente81d0c6f7e975b1b98f1adf84299ba921093d100 (diff)
downloadconky-theme-udt-48fa63ff5d0e12edf86db7f01def635aa0aaa9fb.tar.gz
conky-theme-udt-48fa63ff5d0e12edf86db7f01def635aa0aaa9fb.zip
fix(calendar): mark events past this week on the month grid
The sampler asked khal for 8 days only, so the grid never coloured an event later in the month. Sample through the month's end instead, and cut the event table back to the coming week with calendar_upcoming(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test/test_data.lua')
-rw-r--r--test/test_data.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua
index 9066241..01a55cc 100644
--- a/test/test_data.lua
+++ b/test/test_data.lua
@@ -109,6 +109,14 @@ assert(days[18] == 'personal', 'first event of the day owns it, got '
assert(days[24] == 'work' and days[26] == 'birthdays', 'later days marked')
assert(days[2] == nil, 'October event does not mark September')
+-- upcoming: the table's week out of a month-long cache, across a month end.
+local up = data.calendar_upcoming({ { y = 2026, m = 10, d = 18 },
+ { y = 2026, m = 10, d = 25 }, { y = 2026, m = 10, d = 26 },
+ { y = 2026, m = 10, d = 29 } }, { 2026, 10, 18 }, 8)
+assert(#up == 2 and up[2].d == 25, 'eight days from the 18th end on the 25th')
+assert(#data.calendar_upcoming({ { y = 2026, m = 11, d = 2 } },
+ { 2026, 10, 28 }, 8) == 1, 'week crosses into next month')
+
-- month_shape: September 2026 has 30 days and starts on a Tuesday.
-- Monday = 1, so Tuesday = 2.
local ndays, first = data.month_shape(2026, 9)