@@ -106,34 +106,40 @@ describe('ToggleDone', () => {
106106 it ( 'should add checkbox to hyphen and space' , ( ) => {
107107 testToggleLine ( '|- ' , '- [ ] |' ) ;
108108 testToggleLine ( '- |' , '- [ ] |' ) ;
109- testToggleLine ( '- |foobar' , '- [ ] foobar|' ) ;
109+ testToggleLine ( '1. |foobar' , '1. [ ] foobar|' ) ;
110110
111111 GlobalFilter . getInstance ( ) . set ( '#task' ) ;
112112
113113 testToggleLine ( '|- ' , '- [ ] |' ) ;
114114 testToggleLine ( '- |' , '- [ ] |' ) ;
115- testToggleLine ( '- |foobar' , '- [ ] foobar|' ) ;
115+ testToggleLine ( '1. |foobar' , '1. [ ] foobar|' ) ;
116116 } ) ;
117117
118118 it ( 'should complete a task' , ( ) => {
119119 testToggleLine ( '|- [ ] ' , '|- [x] ✅ 2022-09-04' ) ;
120120 testToggleLine ( '- [ ] |' , '- [x] | ✅ 2022-09-04' ) ;
121+ testToggleLine ( '- [ ] description|' , '- [x] description| ✅ 2022-09-04' ) ;
121122
122123 // Issue #449 - cursor jumped 13 characters to the right on completion
123124 testToggleLine ( '- [ ] I have a |proper description' , '- [x] I have a |proper description ✅ 2022-09-04' ) ;
124125
125126 GlobalFilter . getInstance ( ) . set ( '#task' ) ;
126127
128+ // Done date is not added if task does not match global filter
127129 testToggleLine ( '|- [ ] ' , '|- [x] ' ) ;
128- testToggleLine ( '- [ ] |' , '- [x] |' ) ;
130+ testToggleLine ( '1. [ ] |' , '1. [x] |' ) ;
131+
132+ // Done date is added if task does not match global filter
133+ testToggleLine ( '- [ ] #task|' , '- [x] #tas|k ✅ 2022-09-04' ) ; // Extra space added before #; cursor moves left
134+ testToggleLine ( '* [ ] #task description|' , '* [x] #task description| ✅ 2022-09-04' ) ;
129135
130136 // Issue #449 - cursor jumped 13 characters to the right on completion
131137 testToggleLine ( '- [ ] I have a |proper description' , '- [x] I have a |proper description' ) ;
132138 } ) ;
133139
134140 it ( 'should un-complete a completed task' , ( ) => {
135141 testToggleLine ( '|- [x] ✅ 2022-09-04' , '|- [ ] ' ) ;
136- testToggleLine ( '- [x] ✅ 2022-09-04|' , '- [ ] |' ) ;
142+ testToggleLine ( '1. [x] ✅ 2022-09-04|' , '1. [ ] |' ) ;
137143
138144 // Issue #449 - cursor jumped 13 characters to the left on un-completion
139145 testToggleLine ( '- [x] I have a proper description| ✅ 2022-09-04' , '- [ ] I have a proper description|' ) ;
@@ -142,7 +148,11 @@ describe('ToggleDone', () => {
142148
143149 // Done date is not removed if task does not match global filter
144150 testToggleLine ( '|- [x] ✅ 2022-09-04' , '|- [ ] ✅ 2022-09-04' ) ;
145- testToggleLine ( '- [x] ✅ 2022-09-04|' , '- [ ] ✅ 2022-09-04|' ) ;
151+ testToggleLine ( '+ [x] ✅ 2022-09-04|' , '+ [ ] ✅ 2022-09-04|' ) ;
152+
153+ // Done date is added if task matches the global filter
154+ testToggleLine ( '|- [x] #task ✅ 2022-09-04' , '|- [ ] #task' ) ; // Extra space added before #
155+ testToggleLine ( '1. [x] #task description ✅ 2022-09-04|' , '1. [ ] #task description|' ) ;
146156
147157 // Issue #449 - cursor jumped 13 characters to the left on un-completion
148158 testToggleLine (
0 commit comments