diff --git a/cypress/e2e/task/task.spec.ts b/cypress/e2e/task/task.spec.ts index 4efee58cb..2752e651b 100644 --- a/cypress/e2e/task/task.spec.ts +++ b/cypress/e2e/task/task.spec.ts @@ -546,5 +546,35 @@ describe('Task', () => { cy.get('.bucket .task .footer .icon svg.fa-paperclip') .should('exist') }) + + it('Can check items off a checklist', () => { + const tasks = TaskFactory.create(1, { + id: 1, + description: ` +This is a checklist: + +* [ ] one item +* [ ] another item +* [ ] third item +* [ ] fourth item +* [x] and this one is already done +`, + }) + cy.visit(`/tasks/${tasks[0].id}`) + + cy.get('.task-view .checklist-summary') + .should('contain.text', '1 of 5 tasks') + cy.get('.editor .content ul > li input[type=checkbox]') + .eq(2) + .click() + + cy.get('.editor .content ul > li input[type=checkbox]') + .eq(2) + .should('be.checked') + cy.get('.editor .content input[type=checkbox]') + .should('have.length', 5) + cy.get('.task-view .checklist-summary') + .should('contain.text', '2 of 5 tasks') + }) }) }) diff --git a/src/components/input/editor.vue b/src/components/input/editor.vue index d106813cb..c2041dd8d 100644 --- a/src/components/input/editor.vue +++ b/src/components/input/editor.vue @@ -285,9 +285,9 @@ function handleCheckboxClick(e: Event) { console.debug('no index found') return } - console.debug(index, text.value.slice(index, 9)) - - const listPrefix = text.value.slice(index, 1) + const listPrefix = text.value.substring(index, index + 1) + + console.debug({index, listPrefix, checked, text: text.value}) text.value = replaceAt(text.value, index, `${listPrefix} ${checked ? '[x]' : '[ ]'} `) bubble()