mirror of
https://github.com/freitass/todo.txt-vim.git
synced 2025-11-17 06:13:38 -05:00
Fixes #37. Replacing existing priority
This commit is contained in:
@@ -104,7 +104,7 @@ function! todo#txt#prioritize_add(priority)
|
||||
endfunction
|
||||
|
||||
function! todo#txt#prioritize_add_action(priority)
|
||||
execute "normal! mq0i(".a:priority.") \<esc>`q"
|
||||
execute 's/^\(([a-zA-Z]) \)\?/(' . a:priority . ') /'
|
||||
endfunction
|
||||
|
||||
" Modeline {{{1
|
||||
|
||||
7
test/tc_priority.todo.txt
Normal file
7
test/tc_priority.todo.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
# insert_priority
|
||||
example task
|
||||
# end_insert_priority
|
||||
|
||||
# replace_priority
|
||||
(A) example task
|
||||
# end_replace_priority
|
||||
28
test/tc_priority.vim
Normal file
28
test/tc_priority.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
let s:here = expand('<sfile>:p:h')
|
||||
let s:context = todo#txt#__context__()
|
||||
let s:context['data'] = s:here . '/tc_priority.todo.txt'
|
||||
let s:tc = unittest#testcase#new('Priority', s:context)
|
||||
|
||||
let s:TODAY = strftime("%Y-%m-%d")
|
||||
|
||||
let s:PRIORITY_INSERTED = [
|
||||
\ '(A) example task',
|
||||
\ ]
|
||||
|
||||
let s:PRIORITY_REPLACED = [
|
||||
\ '(C) example task',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_insert_priority()
|
||||
call self.data.goto('insert_priority')
|
||||
call todo#txt#prioritize_add('A')
|
||||
call self.assert_equal(s:PRIORITY_INSERTED, self.data.get('insert_priority'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_replace_priority()
|
||||
call self.data.goto('replace_priority')
|
||||
call todo#txt#prioritize_add('C')
|
||||
call self.assert_equal(s:PRIORITY_REPLACED, self.data.get('replace_priority'))
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
||||
Reference in New Issue
Block a user