mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Merge pull request #2307 from modmod24/fix-todo-percentage
update todo percentage correctly #2267
This commit is contained in:
@@ -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++
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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: 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 }],
|
||||
|
||||
Reference in New Issue
Block a user