fix(tasks): remove a task from its bucket when it is in the first kanban bucket

Resolves https://github.com/go-vikunja/frontend/issues/89
This commit is contained in:
kolaente 2022-11-12 12:13:00 +01:00
parent 293402b6fd
commit 995cc12880
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 35 additions and 2 deletions

View File

@ -204,4 +204,37 @@ describe('List View Kanban', () => {
cy.get('.list-kanban .filter-container .base-button')
.should('exist')
})
it('Should remove a task from the board when deleting it', () => {
const lists = ListFactory.create(1)
const buckets = BucketFactory.create(2, {
list_id: lists[0].id,
})
const tasks = TaskFactory.create(5, {
list_id: 1,
bucket_id: buckets[0].id,
})
const task = tasks[0]
cy.visit('/lists/1/kanban')
cy.getSettled('.kanban .bucket .tasks .task')
.contains(task.title)
.should('be.visible')
.click()
cy.get('.task-view .action-buttons .button')
.should('be.visible')
.contains('Delete')
.click()
cy.get('.modal-mask .modal-container .modal-content .header')
.should('contain', 'Delete this task')
cy.get('.modal-mask .modal-container .modal-content .actions .button')
.contains('Do it!')
.click()
cy.get('.global-notification')
.should('contain', 'Success')
cy.getSettled('.kanban .bucket .tasks')
.should('not.contain', task.title)
})
})

View File

@ -200,9 +200,9 @@ export const useKanbanStore = defineStore('kanban', () => {
const { bucketIndex, taskIndex } = getTaskIndicesById(buckets.value, task.id)
if (
!bucketIndex ||
bucketIndex === null ||
buckets.value[bucketIndex]?.id !== task.bucketId ||
!taskIndex ||
taskIndex === null ||
(buckets.value[bucketIndex]?.tasks[taskIndex]?.id !== task.id)
) {
return