fix(task): setting progress was not properly saved

This commit is contained in:
kolaente 2022-10-05 16:06:41 +02:00
parent fd71de4b5d
commit 1be516a905
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 37 additions and 1 deletions

View file

@ -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')
})
})
})

View file

@ -79,7 +79,7 @@
</div>
<percent-done-select
:disabled="!canWrite"
@update:model-value="saveTask"
@update:model-value="setPercentDone"
ref="percentDone"
v-model="task.percentDone"/>
</div>
@ -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,
})
}
</script>
<style lang="scss" scoped>