mirror of
https://github.com/freitass/todo.txt-vim.git
synced 2025-11-15 05:13:46 -05:00
Fixes #9
This commit is contained in:
@@ -26,7 +26,7 @@ function! s:get_current_date()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! todo#txt#prepend_date()
|
function! todo#txt#prepend_date()
|
||||||
execute 'normal! 0"='.string(s:get_current_date().' ').'
|
execute 's/^\(([a-zA-Z]) \)\?/\1' . s:get_current_date() . ' /'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! todo#txt#mark_as_done()
|
function! todo#txt#mark_as_done()
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
# lorem_ipsum
|
# lorem_ipsum
|
||||||
example task
|
example task
|
||||||
# end_lorem_ipsum
|
# end_lorem_ipsum
|
||||||
|
|
||||||
|
# date_after_priority
|
||||||
|
(A) Call Mom
|
||||||
|
# end_date_after_priority
|
||||||
|
|
||||||
|
# date_after_priority_visual
|
||||||
|
(A) Call Mom
|
||||||
|
(B) Call Dad
|
||||||
|
# end_date_after_priority_visual
|
||||||
|
|||||||
@@ -13,8 +13,13 @@ let s:DATE_INSERTED = [
|
|||||||
\ s:TODAY . ' example task',
|
\ s:TODAY . ' example task',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
let s:DATE_INSERTED_VISUAL = [
|
let s:DATE_INSERTED_AFTER_PRIORITY = [
|
||||||
\ s:TODAY . ' example task',
|
\ '(A) ' . s:TODAY . ' Call Mom',
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
let s:DATE_INSERTED_AFTER_PRIORITY_VISUAL = [
|
||||||
|
\ '(A) ' . s:TODAY . ' Call Mom',
|
||||||
|
\ '(B) ' . s:TODAY . ' Call Dad',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
function! s:tc.test_insert_date_normal_mode()
|
function! s:tc.test_insert_date_normal_mode()
|
||||||
@@ -26,12 +31,24 @@ endfunction
|
|||||||
function! s:tc.test_insert_date_insert_mode()
|
function! s:tc.test_insert_date_insert_mode()
|
||||||
call self.data.goto('lorem_ipsum')
|
call self.data.goto('lorem_ipsum')
|
||||||
execute 'normal idate '
|
execute 'normal idate '
|
||||||
call self.assert_equal(s:DATE_INSERTED_VISUAL, self.data.get('lorem_ipsum'))
|
call self.assert_equal(s:DATE_INSERTED, self.data.get('lorem_ipsum'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:tc.test_insert_date_visual_mode()
|
function! s:tc.test_insert_date_visual_mode()
|
||||||
call self.data.visual_execute('call todo#txt#prepend_date()', 'lorem_ipsum')
|
call self.data.visual_execute('call todo#txt#prepend_date()', 'lorem_ipsum')
|
||||||
call self.assert_equal(s:DATE_INSERTED_VISUAL, self.data.get('lorem_ipsum'))
|
call self.assert_equal(s:DATE_INSERTED, self.data.get('lorem_ipsum'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:tc.test_insert_date_after_priority_normal_mode()
|
||||||
|
call self.data.goto('date_after_priority')
|
||||||
|
call self.data.execute('call todo#txt#prepend_date()', 'date_after_priority')
|
||||||
|
call self.assert_equal(s:DATE_INSERTED_AFTER_PRIORITY, self.data.get('date_after_priority'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:tc.test_insert_date_after_priority_visual_mode()
|
||||||
|
call self.data.goto('date_after_priority_visual')
|
||||||
|
call self.data.visual_execute('call todo#txt#prepend_date()', 'date_after_priority_visual')
|
||||||
|
call self.assert_equal(s:DATE_INSERTED_AFTER_PRIORITY_VISUAL, self.data.get('date_after_priority_visual'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
unlet s:tc
|
unlet s:tc
|
||||||
|
|||||||
Reference in New Issue
Block a user