test(client): cover bare gl/gL remove-checkbox + command-driven remove-done
Swap the gl<Space>/gL<Space> surface assertions for bare gl/gL; add behavioral cases for gl (item) and gL (whole list) remove-checkbox, and drive remove-done through :NuwikiRemoveDone / :NuwikiRemoveDone! now that it is command-only. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -188,7 +188,7 @@ let s:mapping_surface = [
|
|||||||
\ ['<C-Space>', 'nx'], ['<C-@>', 'nx'], ['<Nul>', 'nx'],
|
\ ['<C-Space>', 'nx'], ['<C-@>', 'nx'], ['<Nul>', 'nx'],
|
||||||
\ ['gnt', 'n'], ['gln', 'nx'], ['glp', 'nx'], ['glx', 'nx'],
|
\ ['gnt', 'n'], ['gln', 'nx'], ['glp', 'nx'], ['glx', 'nx'],
|
||||||
\ ['glh', 'n'], ['gll', 'n'], ['gLh', 'n'], ['gLl', 'n'],
|
\ ['glh', 'n'], ['gll', 'n'], ['gLh', 'n'], ['gLl', 'n'],
|
||||||
\ ['glr', 'n'], ['gLr', 'n'], ['gl<Space>', 'n'], ['gL<Space>', 'n'],
|
\ ['glr', 'n'], ['gLr', 'n'], ['gl', 'n'], ['gL', 'n'],
|
||||||
\ ['gl-', 'n'], ['gL-', 'n'], ['gl*', 'n'], ['gL*', 'n'],
|
\ ['gl-', 'n'], ['gL-', 'n'], ['gl*', 'n'], ['gL*', 'n'],
|
||||||
\ ['gl#', 'n'], ['gL#', 'n'], ['gl1', 'n'], ['gL1', 'n'],
|
\ ['gl#', 'n'], ['gL#', 'n'], ['gl1', 'n'], ['gL1', 'n'],
|
||||||
\ ['gli', 'n'], ['gLi', 'n'], ['glI', 'n'], ['gLI', 'n'],
|
\ ['gli', 'n'], ['gLi', 'n'], ['glI', 'n'], ['gLI', 'n'],
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ vim.defer_fn(function()
|
|||||||
{ '<C-Space>', 'nx' }, { '<C-@>', 'nx' }, { '<Nul>', 'nx' },
|
{ '<C-Space>', 'nx' }, { '<C-@>', 'nx' }, { '<Nul>', 'nx' },
|
||||||
{ 'gnt', 'n' }, { 'gln', 'nx' }, { 'glp', 'nx' }, { 'glx', 'nx' },
|
{ 'gnt', 'n' }, { 'gln', 'nx' }, { 'glp', 'nx' }, { 'glx', 'nx' },
|
||||||
{ 'glh', 'n' }, { 'gll', 'n' }, { 'gLh', 'n' }, { 'gLl', 'n' },
|
{ 'glh', 'n' }, { 'gll', 'n' }, { 'gLh', 'n' }, { 'gLl', 'n' },
|
||||||
{ 'glr', 'n' }, { 'gLr', 'n' }, { 'gl<Space>', 'n' }, { 'gL<Space>', 'n' },
|
{ 'glr', 'n' }, { 'gLr', 'n' }, { 'gl', 'n' }, { 'gL', 'n' },
|
||||||
{ 'gl-', 'n' }, { 'gL-', 'n' }, { 'gl*', 'n' }, { 'gL*', 'n' },
|
{ 'gl-', 'n' }, { 'gL-', 'n' }, { 'gl*', 'n' }, { 'gL*', 'n' },
|
||||||
{ 'gl#', 'n' }, { 'gL#', 'n' }, { 'gl1', 'n' }, { 'gL1', 'n' },
|
{ 'gl#', 'n' }, { 'gL#', 'n' }, { 'gl1', 'n' }, { 'gL1', 'n' },
|
||||||
{ 'gli', 'n' }, { 'gLi', 'n' }, { 'glI', 'n' }, { 'gLI', 'n' },
|
{ 'gli', 'n' }, { 'gLi', 'n' }, { 'glI', 'n' }, { 'gLI', 'n' },
|
||||||
@@ -340,33 +340,51 @@ vim.defer_fn(function()
|
|||||||
expect_lines = { '1. one', '2. two', '3. three' },
|
expect_lines = { '1. one', '2. two', '3. three' },
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ===== Remove done (gl<Space> current list / gL<Space> whole doc) =====
|
-- ===== Remove checkbox (bare gl item / gL whole list) =====
|
||||||
|
|
||||||
-- `gl<Space>` removes done items from the cursor's list only; the
|
-- Bare `gl` strips the checkbox from the cursor's item, keeping the text.
|
||||||
|
run('list.remove_checkbox_item_via_gl', {
|
||||||
|
lines = { '= test =', '- [ ] task', '- [X] done' },
|
||||||
|
cursor = { 2, 0 },
|
||||||
|
keys = 'gl',
|
||||||
|
expect_line = '- task',
|
||||||
|
expect_at = 2,
|
||||||
|
})
|
||||||
|
-- Bare `gL` strips the checkbox from every item in the cursor's list.
|
||||||
|
run('list.remove_checkbox_list_via_gL', {
|
||||||
|
lines = { '- [ ] a', '- [X] b', '- [ ] c' },
|
||||||
|
cursor = { 1, 0 },
|
||||||
|
keys = 'gL',
|
||||||
|
expect_lines = { '- a', '- b', '- c' },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- ===== Remove done (command-only: :NuwikiRemoveDone[!]) =====
|
||||||
|
|
||||||
|
-- `:NuwikiRemoveDone` removes done items from the cursor's list only; the
|
||||||
-- second list's done item survives.
|
-- second list's done item survives.
|
||||||
run('list.remove_done_current_list_via_gl_space', {
|
run('list.remove_done_current_list_via_command', {
|
||||||
lines = {
|
lines = {
|
||||||
'- [X] done a', '- [ ] todo a', '',
|
'- [X] done a', '- [ ] todo a', '',
|
||||||
'paragraph', '',
|
'paragraph', '',
|
||||||
'- [ ] todo b', '- [X] done b',
|
'- [ ] todo b', '- [X] done b',
|
||||||
},
|
},
|
||||||
cursor = { 1, 0 },
|
cursor = { 1, 0 },
|
||||||
keys = 'gl<Space>',
|
keys = ':NuwikiRemoveDone<CR>',
|
||||||
expect_lines = {
|
expect_lines = {
|
||||||
'- [ ] todo a', '',
|
'- [ ] todo a', '',
|
||||||
'paragraph', '',
|
'paragraph', '',
|
||||||
'- [ ] todo b', '- [X] done b',
|
'- [ ] todo b', '- [X] done b',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
-- `gL<Space>` sweeps the whole buffer regardless of cursor position.
|
-- `:NuwikiRemoveDone!` sweeps the whole buffer regardless of cursor position.
|
||||||
run('list.remove_done_whole_buffer_via_gL_space', {
|
run('list.remove_done_whole_buffer_via_command_bang', {
|
||||||
lines = {
|
lines = {
|
||||||
'- [X] done a', '- [ ] todo a', '',
|
'- [X] done a', '- [ ] todo a', '',
|
||||||
'paragraph', '',
|
'paragraph', '',
|
||||||
'- [ ] todo b', '- [X] done b',
|
'- [ ] todo b', '- [X] done b',
|
||||||
},
|
},
|
||||||
cursor = { 1, 0 },
|
cursor = { 1, 0 },
|
||||||
keys = 'gL<Space>',
|
keys = ':NuwikiRemoveDone!<CR>',
|
||||||
expect_lines = {
|
expect_lines = {
|
||||||
'- [ ] todo a', '',
|
'- [ ] todo a', '',
|
||||||
'paragraph', '',
|
'paragraph', '',
|
||||||
|
|||||||
Reference in New Issue
Block a user