Skip to content

Commit 932a380

Browse files
committed
test: - Add preparatory tests for #3708
1 parent ccb5f00 commit 932a380

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/Commands/ToggleDone.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,21 @@ describe('ToggleDone', () => {
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] ');
128130
testToggleLine('- [ ] |', '- [x] |');
129131

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');
135+
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
});
@@ -144,6 +150,10 @@ describe('ToggleDone', () => {
144150
testToggleLine('|- [x] ✅ 2022-09-04', '|- [ ] ✅ 2022-09-04');
145151
testToggleLine('- [x] ✅ 2022-09-04|', '- [ ] ✅ 2022-09-04|');
146152

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('- [x] #task description ✅ 2022-09-04|', '- [ ] #task description|');
156+
147157
// Issue #449 - cursor jumped 13 characters to the left on un-completion
148158
testToggleLine(
149159
'- [x] I have a proper description| ✅ 2022-09-04',

0 commit comments

Comments
 (0)