mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Fixed regex to stop [anytingx] being counted as a checkmark
This commit is contained in:
@@ -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\] ./)) {
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user