mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-12 01:59:34 -05:00
fix(frontend): mark only clicked task item (#891)
This commit is contained in:
committed by
GitHub
parent
7d954cd5bf
commit
a1655489ab
@@ -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', () => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user