Revert "feat(diff): disallow editing done tasks by default (#132)" (#133)

This reverts commit 24e8741ae1.
This commit is contained in:
Barrett Ruth 2026-03-10 22:45:07 -04:00 committed by GitHub
parent 8e1795a1f2
commit 6e385db3c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 76 additions and 148 deletions

View file

@ -287,66 +287,5 @@ describe('diff', function()
local task = s:get(1)
assert.are.equal(0, task.priority)
end)
it('rejects editing description of a done task', function()
local t = s:add({ description = 'Finished work', status = 'done' })
t['end'] = '2026-03-01T00:00:00Z'
s:save()
local lines = {
'# Todo',
'/1/- [x] Changed description',
}
diff.apply(lines, s)
s:load()
local task = s:get(1)
assert.are.equal('Finished work', task.description)
assert.are.equal('done', task.status)
end)
it('allows toggling done task back to pending', function()
local t = s:add({ description = 'Finished work', status = 'done' })
t['end'] = '2026-03-01T00:00:00Z'
s:save()
local lines = {
'# Todo',
'/1/- [ ] Finished work',
}
diff.apply(lines, s)
s:load()
local task = s:get(1)
assert.are.equal('pending', task.status)
end)
it('allows editing done task when lock_done is false', function()
local cfg = require('pending.config')
vim.g.pending = { lock_done = false }
cfg.reset()
local t = s:add({ description = 'Finished work', status = 'done' })
t['end'] = '2026-03-01T00:00:00Z'
s:save()
local lines = {
'# Todo',
'/1/- [x] Changed description',
}
diff.apply(lines, s)
s:load()
local task = s:get(1)
assert.are.equal('Changed description', task.description)
vim.g.pending = {}
cfg.reset()
end)
it('does not affect editing of pending tasks', function()
s:add({ description = 'Active task' })
s:save()
local lines = {
'# Todo',
'/1/- [ ] Updated active task',
}
diff.apply(lines, s)
s:load()
local task = s:get(1)
assert.are.equal('Updated active task', task.description)
end)
end)
end)