diff --git a/browser/lib/getTodoStatus.js b/browser/lib/getTodoStatus.js index dc3deb8ad..0dde25cba 100644 --- a/browser/lib/getTodoStatus.js +++ b/browser/lib/getTodoStatus.js @@ -5,7 +5,7 @@ export function getTodoStatus (content) { splitted.forEach((line) => { const trimmedLine = line.trim() - if (trimmedLine.match(/^[\+\-\*] \[\s|x\] ./)) { + if (trimmedLine.match(/^[\+\-\*] \[(\s|x)\] ./)) { numberOfTodo++ } if (trimmedLine.match(/^[\+\-\*] \[x\] ./)) { diff --git a/tests/lib/get-todo-status-test.js b/tests/lib/get-todo-status-test.js index 55f951f50..c97ae2b9c 100644 --- a/tests/lib/get-todo-status-test.js +++ b/tests/lib/get-todo-status-test.js @@ -11,7 +11,12 @@ test('getTodoStatus should return a correct hash object', t => { ['- [ ] a\n', { total: 1, completed: 0 }], ['- [ ] a\n- [x] a\n', { total: 2, completed: 1 }], ['+ [ ] a\n', { total: 1, completed: 0 }], - ['+ [ ] a\n+ [x] a\n', { total: 2, completed: 1 }] + ['+ [ ] a\n+ [x] a\n', { total: 2, completed: 1 }], + ['+ [ ] a\n+ [testx] a\n', { total: 1, completed: 0 }], + ['+ [ ] a\n+ [xtest] a\n', { total: 1, completed: 0 }], + ['+ [ ] a\n+ foo[x]bar a\n', { total: 1, completed: 0 }], + ['+ [ ] a\n+ foo[x] bar a\n', { total: 1, completed: 0 }], + ['+ [ ] a\n+ foo [x]bar a\n', { total: 1, completed: 0 }] ] testCases.forEach(testCase => {