Problem: `header` and `category` were separate icons for the same concept. The icon overlay replaced `[ ]` with a bare character, hiding the markdown checkbox syntax. Header format `## ` produced a double-space with single-char icons. Solution: merge `header` into `category` (one icon for both header lines and EOL labels). Overlay renders `[icon]` preserving bracket syntax. Change header line format from `## ` to `# ` so the 2-char overlay (`# `) maps cleanly.
56 lines
1.4 KiB
Lua
56 lines
1.4 KiB
Lua
require('spec.helpers')
|
|
|
|
local config = require('pending.config')
|
|
|
|
describe('icons', function()
|
|
before_each(function()
|
|
vim.g.pending = nil
|
|
config.reset()
|
|
end)
|
|
|
|
after_each(function()
|
|
vim.g.pending = nil
|
|
config.reset()
|
|
end)
|
|
|
|
it('has default icon values', function()
|
|
local icons = config.get().icons
|
|
assert.equals(' ', icons.pending)
|
|
assert.equals('x', icons.done)
|
|
assert.equals('!', icons.priority)
|
|
assert.equals('.', icons.due)
|
|
assert.equals('~', icons.recur)
|
|
assert.equals('#', icons.category)
|
|
end)
|
|
|
|
it('allows overriding individual icons', function()
|
|
vim.g.pending = { icons = { pending = '*', done = '+' } }
|
|
config.reset()
|
|
local icons = config.get().icons
|
|
assert.equals('*', icons.pending)
|
|
assert.equals('+', icons.done)
|
|
assert.equals('!', icons.priority)
|
|
assert.equals('#', icons.category)
|
|
end)
|
|
|
|
it('allows overriding all icons', function()
|
|
vim.g.pending = {
|
|
icons = {
|
|
pending = '-',
|
|
done = '+',
|
|
priority = '*',
|
|
due = '@',
|
|
recur = '^',
|
|
category = '&',
|
|
},
|
|
}
|
|
config.reset()
|
|
local icons = config.get().icons
|
|
assert.equals('-', icons.pending)
|
|
assert.equals('+', icons.done)
|
|
assert.equals('*', icons.priority)
|
|
assert.equals('@', icons.due)
|
|
assert.equals('^', icons.recur)
|
|
assert.equals('&', icons.category)
|
|
end)
|
|
end)
|