generated from eblume/project-template
Some checks failed
Build / validate (pull_request) Failing after 1m17s
`:Heph next`/`list` rows now render a compact relative do/late date chip (today/tomorrow/yesterday/MM-DD/YYYY-MM-DD, mirroring heph-tui's fmt) and a recurrence ↻, so scheduling is visible at a glance. `<CR>` already jumps to a row's canonical-context doc. e2e: a do-date-chip render assertion. Completes the §14 item-2 task-list UX wave. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
2.4 KiB
Lua
57 lines
2.4 KiB
Lua
-- Filter views (tech-spec §8.2): `:Heph view <name>` renders a built-in slice.
|
|
|
|
local h = require("e2e.helpers")
|
|
|
|
describe("filter views", function()
|
|
local ctx
|
|
before_each(function()
|
|
ctx = h.start()
|
|
end)
|
|
after_each(function()
|
|
h.stop(ctx)
|
|
end)
|
|
|
|
it("renders the Top of Mind view (red|orange, not blue)", function()
|
|
ctx.q:call("task.create", { title = "urgent thing", attention = "red" })
|
|
ctx.q:call("task.create", { title = "warm thing", attention = "orange" })
|
|
ctx.q:call("task.create", { title = "cool thing", attention = "blue" })
|
|
|
|
-- The backend view returns just the red + orange tasks.
|
|
local rows = ctx.q:call("view", { name = "tom" })
|
|
assert.are.equal(2, #rows)
|
|
|
|
-- The plugin renders them into a dedicated view buffer.
|
|
require("heph.view").view("tom")
|
|
local buf = vim.api.nvim_get_current_buf()
|
|
assert.is_truthy(
|
|
vim.api.nvim_buf_get_name(buf):find("heph://view/tom", 1, true),
|
|
"view buffer not named heph://view/tom"
|
|
)
|
|
local text = table.concat(vim.api.nvim_buf_get_lines(buf, 0, -1, false), "\n")
|
|
assert.is_truthy(text:find("urgent thing", 1, true), "red task missing from ToM")
|
|
assert.is_truthy(text:find("warm thing", 1, true), "orange task missing from ToM")
|
|
assert.is_falsy(text:find("cool thing", 1, true), "blue task should not be in ToM")
|
|
end)
|
|
|
|
it("shows a do-date chip on a dated task row", function()
|
|
-- A past do-date keeps the task actionable (so it appears in ToM) and, with
|
|
-- no late_on, renders as a `do:` chip rather than a `late:` one.
|
|
ctx.q:call("task.create", { title = "dated thing", attention = "red", do_date = 1704067200000 })
|
|
|
|
require("heph.view").view("tom")
|
|
local buf = vim.api.nvim_get_current_buf()
|
|
local text = table.concat(vim.api.nvim_buf_get_lines(buf, 0, -1, false), "\n")
|
|
assert.is_truthy(text:find("dated thing", 1, true), "dated task missing")
|
|
assert.is_truthy(text:find("do:", 1, true), "do-date chip missing from the row")
|
|
end)
|
|
|
|
it("scopes the chores view to chore projects via the daemon", function()
|
|
local chores = ctx.q:call("node.create", { kind = "project", title = "Chores" })
|
|
ctx.q:call("task.create", { title = "take out trash", attention = "white", project_id = chores.id })
|
|
ctx.q:call("task.create", { title = "unrelated", attention = "white" })
|
|
|
|
local rows = ctx.q:call("view", { name = "chores" })
|
|
assert.are.equal(1, #rows)
|
|
assert.are.equal("take out trash", rows[1].title)
|
|
end)
|
|
end)
|