From 760f84d7fa82abbd82de0caad04f33a3841bd856 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 18 Aug 2018 14:30:23 +0100 Subject: [PATCH] fix for 2267 todo percentage not updated correctly --- browser/lib/getTodoStatus.js | 4 ++-- tests/lib/get-todo-status-test.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/browser/lib/getTodoStatus.js b/browser/lib/getTodoStatus.js index 0dde25cb..ab0d7809 100644 --- a/browser/lib/getTodoStatus.js +++ b/browser/lib/getTodoStatus.js @@ -5,10 +5,10 @@ export function getTodoStatus (content) { splitted.forEach((line) => { const trimmedLine = line.trim() - if (trimmedLine.match(/^[\+\-\*] \[(\s|x)\] ./)) { + if (trimmedLine.match(/^[\+\-\*] \[(\s|x)\] ./i)) { numberOfTodo++ } - if (trimmedLine.match(/^[\+\-\*] \[x\] ./)) { + if (trimmedLine.match(/^[\+\-\*] \[x\] ./i)) { numberOfCompletedTodo++ } }) diff --git a/tests/lib/get-todo-status-test.js b/tests/lib/get-todo-status-test.js index c97ae2b9..1eea25d0 100644 --- a/tests/lib/get-todo-status-test.js +++ b/tests/lib/get-todo-status-test.js @@ -12,6 +12,7 @@ test('getTodoStatus should return a correct hash object', t => { ['- [ ] 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: 2 }], ['+ [ ] 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 }],