From 1be516a9055d3eed50ca1515fd916f65c09b6111 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 5 Oct 2022 16:06:41 +0200 Subject: [PATCH] fix(task): setting progress was not properly saved --- cypress/e2e/task/task.spec.ts | 25 +++++++++++++++++++++++++ src/views/tasks/TaskDetailView.vue | 13 ++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/task/task.spec.ts b/cypress/e2e/task/task.spec.ts index af95b56c..0c2794ab 100644 --- a/cypress/e2e/task/task.spec.ts +++ b/cypress/e2e/task/task.spec.ts @@ -440,5 +440,30 @@ describe('Task', () => { .get('.select select') .should('have.value', '4') }) + + it.only('Can set the progress for a task', () => { + const tasks = TaskFactory.create(1, { + id: 1, + }) + cy.visit(`/tasks/${tasks[0].id}`) + + cy.get('.task-view .action-buttons .button') + .contains('Set Progress') + .click() + cy.get('.task-view .columns.details .column') + .contains('Progress') + .get('.select select') + .select('50%') + cy.get('.global-notification') + .should('contain', 'Success') + + cy.wait(200) + + cy.get('.task-view .columns.details .column') + .contains('Progress') + .get('.select select') + .should('be.visible') + .should('have.value', '0.5') + }) }) }) diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 8c7606c9..f994696f 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -79,7 +79,7 @@ @@ -765,6 +765,17 @@ async function setPriority(priority: Priority) { task: newTask, }) } + +async function setPercentDone(percentDone: number) { + const newTask: ITask = { + ...task, + percentDone, + } + + return saveTask({ + task: newTask, + }) +}