fix(task): setting a label would not show up on the kanban board after setting it
This commit is contained in:
parent
1be516a905
commit
01f648c20c
3 changed files with 48 additions and 17 deletions
|
@ -13,14 +13,36 @@ import {BucketFactory} from '../../factories/bucket'
|
||||||
|
|
||||||
import '../../support/authenticateUser'
|
import '../../support/authenticateUser'
|
||||||
|
|
||||||
|
function addLabelToTaskAndVerify(labelTitle: string) {
|
||||||
|
cy.get('.task-view .action-buttons .button')
|
||||||
|
.contains('Add Labels')
|
||||||
|
.click()
|
||||||
|
cy.get('.task-view .details.labels-list .multiselect input')
|
||||||
|
.type(labelTitle)
|
||||||
|
cy.get('.task-view .details.labels-list .multiselect .search-results')
|
||||||
|
.children()
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
|
||||||
|
cy.get('.global-notification', { timeout: 4000 })
|
||||||
|
.should('contain', 'Success')
|
||||||
|
cy.get('.task-view .details.labels-list .multiselect .input-wrapper span.tag')
|
||||||
|
.should('exist')
|
||||||
|
.should('contain', labelTitle)
|
||||||
|
}
|
||||||
|
|
||||||
describe('Task', () => {
|
describe('Task', () => {
|
||||||
let namespaces
|
let namespaces
|
||||||
let lists
|
let lists
|
||||||
|
let buckets
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
UserFactory.create(1)
|
UserFactory.create(1)
|
||||||
namespaces = NamespaceFactory.create(1)
|
namespaces = NamespaceFactory.create(1)
|
||||||
lists = ListFactory.create(1)
|
lists = ListFactory.create(1)
|
||||||
|
buckets = BucketFactory.create(1, {
|
||||||
|
list_id: lists[0].id,
|
||||||
|
})
|
||||||
TaskFactory.truncate()
|
TaskFactory.truncate()
|
||||||
UserListFactory.truncate()
|
UserListFactory.truncate()
|
||||||
})
|
})
|
||||||
|
@ -345,21 +367,31 @@ describe('Task', () => {
|
||||||
|
|
||||||
cy.visit(`/tasks/${tasks[0].id}`)
|
cy.visit(`/tasks/${tasks[0].id}`)
|
||||||
|
|
||||||
cy.get('.task-view .action-buttons .button')
|
addLabelToTaskAndVerify(labels[0].title)
|
||||||
.contains('Add Labels')
|
})
|
||||||
.click()
|
|
||||||
cy.get('.task-view .details.labels-list .multiselect input')
|
it('Can add a label to a task and it shows up on the kanban board afterwards', () => {
|
||||||
.type(labels[0].title)
|
const tasks = TaskFactory.create(1, {
|
||||||
cy.get('.task-view .details.labels-list .multiselect .search-results')
|
id: 1,
|
||||||
.children()
|
list_id: lists[0].id,
|
||||||
.first()
|
bucket_id: buckets[0].id,
|
||||||
|
})
|
||||||
|
const labels = LabelFactory.create(1)
|
||||||
|
LabelTaskFactory.truncate()
|
||||||
|
|
||||||
|
cy.visit(`/lists/${lists[0].id}/kanban`)
|
||||||
|
|
||||||
|
cy.get('.bucket .task')
|
||||||
|
.contains(tasks[0].title)
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.get('.global-notification', { timeout: 4000 })
|
addLabelToTaskAndVerify(labels[0].title)
|
||||||
.should('contain', 'Success')
|
|
||||||
cy.get('.task-view .details.labels-list .multiselect .input-wrapper span.tag')
|
cy.get('.modal-content .close')
|
||||||
.should('exist')
|
.click()
|
||||||
.should('contain', labels[0].title)
|
|
||||||
|
cy.get('.bucket .task')
|
||||||
|
.should('contain.text', labels[0].title)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Can remove a label from a task', () => {
|
it('Can remove a label from a task', () => {
|
||||||
|
@ -441,7 +473,7 @@ describe('Task', () => {
|
||||||
.should('have.value', '4')
|
.should('have.value', '4')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.only('Can set the progress for a task', () => {
|
it('Can set the progress for a task', () => {
|
||||||
const tasks = TaskFactory.create(1, {
|
const tasks = TaskFactory.create(1, {
|
||||||
id: 1,
|
id: 1,
|
||||||
})
|
})
|
||||||
|
|
|
@ -76,11 +76,10 @@ export const useKanbanStore = defineStore('kanban', {
|
||||||
return (id: ITask['id']) => {
|
return (id: ITask['id']) => {
|
||||||
const { bucketIndex, taskIndex } = getTaskIndicesById(state, id)
|
const { bucketIndex, taskIndex } = getTaskIndicesById(state, id)
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bucketIndex,
|
bucketIndex,
|
||||||
taskIndex,
|
taskIndex,
|
||||||
task: bucketIndex && taskIndex && state.buckets[bucketIndex]?.tasks?.[taskIndex] || null,
|
task: bucketIndex !== null && taskIndex !== null && state.buckets[bucketIndex]?.tasks?.[taskIndex] || null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -252,7 +252,7 @@ export const useTaskStore = defineStore('task', {
|
||||||
// Don't try further adding a label if the task is not in kanban
|
// Don't try further adding a label if the task is not in kanban
|
||||||
// Usually this means the kanban board hasn't been accessed until now.
|
// Usually this means the kanban board hasn't been accessed until now.
|
||||||
// Vuex seems to have its difficulties with that, so we just log the error and fail silently.
|
// Vuex seems to have its difficulties with that, so we just log the error and fail silently.
|
||||||
console.debug('Could not add label to task in kanban, task not found', t)
|
console.debug('Could not add label to task in kanban, task not found', {taskId, t})
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue