fix(frontend): mark only clicked task item (#891)

This commit is contained in:
Dominik Pschenitschni
2025-06-16 22:43:54 +02:00
committed by GitHub
parent 7d954cd5bf
commit a1655489ab
2 changed files with 38 additions and 1 deletions

View File

@@ -951,6 +951,43 @@ describe('Task', () => {
.should('have.length', 5)
cy.get('.task-view .checklist-summary')
.should('contain.text', '2 of 5 tasks')
})
it('Persists checked checklist items after reload', () => {
const tasks = TaskFactory.create(1, {
id: 1,
description: `
<ul data-type="taskList">
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label>
<div><p>First Item</p></div>
</li>
<li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label>
<div><p>Second Item</p></div>
</li>
</ul>`,
})
cy.visit(`/tasks/${tasks[0].id}`)
cy.get('.task-view .checklist-summary')
.should('contain.text', '0 of 2 tasks')
cy.get('.tiptap__editor ul > li input[type=checkbox]')
.first()
.click()
cy.get('.task-view .details.content.description h3 span.is-small.has-text-success')
.contains('Saved!')
.should('exist')
cy.get('.task-view .checklist-summary')
.should('contain.text', '1 of 2 tasks')
cy.reload()
cy.get('.task-view .checklist-summary')
.should('contain.text', '1 of 2 tasks')
cy.get('.tiptap__editor ul > li input[type=checkbox]')
.first()
.should('be.checked')
})
it('Should use the editor to render description', () => {

View File

@@ -452,7 +452,7 @@ const extensions : Extensions = [
// https://github.com/ueberdosis/tiptap/issues/3676
editor.value!.state.doc.descendants((subnode, pos) => {
if (node.eq(subnode)) {
if (subnode === node) {
const {tr} = editor.value!.state
tr.setNodeMarkup(pos, undefined, {
...node.attrs,