aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_data.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-14 11:27:41 +0100
committerDanilo M. <danix@danix.xyz>2026-11-14 11:27:41 +0100
commitc39361726fa9cf1623d49ea1b9b2dd7e43f67622 (patch)
treef48bdef65dc66546e9b486a6379d2cd6515d1af4 /test/test_data.lua
parent7ade0f07325d5fb92e530b6ec1bb8d4f9896be73 (diff)
downloadconky-theme-udt-c39361726fa9cf1623d49ea1b9b2dd7e43f67622.tar.gz
conky-theme-udt-c39361726fa9cf1623d49ea1b9b2dd7e43f67622.zip
feat(calendar): list due tasks from a task vdir beside the events
The sampler reads open VTODOs with a due date from ~/.local/share/tasks/<list>/*.ics (a vdirsyncer filesystem storage, override with UDT_TASKS_DIR) and writes them to the cache as ISO 'task' lines. The card merges them into the week's rows by date, with a checkbox before the title and an urgency colour: overdue critical, due today warning, later label. Overdue tasks stay until done, so they lead the table. Tasks never mark the month grid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test/test_data.lua')
-rw-r--r--test/test_data.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua
index c33e5ae..9612c43 100644
--- a/test/test_data.lua
+++ b/test/test_data.lua
@@ -117,6 +117,22 @@ 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')
+-- Tasks: separate from events so the grid stays appointments-only, merged
+-- with them by date for the table. An overdue task is kept (it sorts first),
+-- one past the week is cut like an event, and an all-day row sorts before a
+-- timed one on the same day, as khal orders them.
+assert(#cal.tasks == 3, 'task count, got ' .. tostring(#cal.tasks))
+assert(cal.tasks[1].task and cal.tasks[1].start == nil
+ and cal.tasks[2].start == '17:00', 'task fields')
+local ag = data.calendar_agenda(cal, { 2026, 9, 18 }, 8)
+local titles = {}
+for i, e in ipairs(ag) do titles[i] = e.title end
+assert(table.concat(titles, ',') == 'Overdue chore,A birthday,Dentist,'
+ .. 'Task due today,Team sync | notes',
+ 'agenda order, got ' .. table.concat(titles, ','))
+assert(#data.calendar_agenda(empty, { 2026, 9, 18 }, 8) == 0,
+ 'no events, no tasks: empty agenda')
+
-- 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)