-
-
Notifications
You must be signed in to change notification settings - Fork 665
fix(frontend/kanban): honor server bucket redirect when dropping a recurring task on Done #2621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7273a0d
fix(frontend/kanban): honor server bucket redirect on drag (#2618)
kolaente accb29b
test(kanban): cover moveTaskToBucket
kolaente 942bdc5
test(e2e/kanban): cover recurring task drag to done bucket (#2618)
kolaente 830b546
test(e2e/kanban): seed the view only once with done_bucket_id
kolaente File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import {beforeEach, describe, expect, it, vi} from 'vitest' | ||
| import {createPinia, setActivePinia} from 'pinia' | ||
|
|
||
| vi.mock('vue-router', () => ({ | ||
| useRouter: () => ({push: vi.fn()}), | ||
| })) | ||
|
|
||
| vi.mock('vue-i18n', () => ({ | ||
| useI18n: () => ({t: (key: string) => key}), | ||
| createI18n: () => ({global: {t: (key: string) => key}}), | ||
| })) | ||
|
|
||
| vi.mock('@/stores/base', () => ({ | ||
| useBaseStore: () => ({ | ||
| currentProject: null, | ||
| setCurrentProject: vi.fn(), | ||
| }), | ||
| })) | ||
|
|
||
| vi.mock('@/stores/auth', () => ({ | ||
| useAuthStore: () => ({ | ||
| authUser: true, | ||
| info: null, | ||
| }), | ||
| })) | ||
|
|
||
| import {useKanbanStore} from './kanban' | ||
|
|
||
| import type {IBucket} from '@/modelTypes/IBucket' | ||
| import type {ITask} from '@/modelTypes/ITask' | ||
|
|
||
| function makeBucket(id: number, title: string, tasks: ITask[] = []): IBucket { | ||
| return { | ||
| id, | ||
| title, | ||
| projectViewId: 1, | ||
| tasks, | ||
| count: tasks.length, | ||
| } as IBucket | ||
| } | ||
|
|
||
| function makeTask(id: number, bucketId: number): ITask { | ||
| return { | ||
| id, | ||
| title: `Task ${id}`, | ||
| bucketId, | ||
| } as ITask | ||
| } | ||
|
|
||
| describe('kanban store: moveTaskToBucket', () => { | ||
| beforeEach(() => { | ||
| setActivePinia(createPinia()) | ||
| }) | ||
|
|
||
| it('relocates a task from its current bucket into the target bucket', () => { | ||
| const kanban = useKanbanStore() | ||
| kanban.setBuckets([makeBucket(1, 'To-Do'), makeBucket(2, 'Done')]) | ||
|
|
||
| const task = makeTask(42, 2) | ||
| kanban.addTaskToBucket(task) | ||
| expect(kanban.buckets[1].tasks.map(t => t.id)).toEqual([42]) | ||
|
|
||
| kanban.moveTaskToBucket(task, 1) | ||
|
|
||
| expect(kanban.buckets[0].tasks.map(t => t.id)).toEqual([42]) | ||
| expect(kanban.buckets[0].tasks[0].bucketId).toBe(1) | ||
| expect(kanban.buckets[1].tasks.map(t => t.id)).toEqual([]) | ||
| }) | ||
|
|
||
| it('is a no-op when the task is already in the target bucket', () => { | ||
| const kanban = useKanbanStore() | ||
| kanban.setBuckets([makeBucket(1, 'To-Do'), makeBucket(2, 'Done')]) | ||
|
|
||
| const task = makeTask(42, 1) | ||
| kanban.addTaskToBucket(task) | ||
|
|
||
| kanban.moveTaskToBucket(task, 1) | ||
|
|
||
| expect(kanban.buckets[0].tasks.map(t => t.id)).toEqual([42]) | ||
| expect(kanban.buckets[1].tasks.map(t => t.id)).toEqual([]) | ||
| }) | ||
|
|
||
| it('is a no-op when the task is not present in any bucket', () => { | ||
| const kanban = useKanbanStore() | ||
| kanban.setBuckets([makeBucket(1, 'To-Do'), makeBucket(2, 'Done')]) | ||
|
|
||
| const strayTask = makeTask(99, 2) | ||
| kanban.moveTaskToBucket(strayTask, 1) | ||
|
|
||
| expect(kanban.buckets[0].tasks).toEqual([]) | ||
| expect(kanban.buckets[1].tasks).toEqual([]) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to seed and then override again later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in 830b546 — dropped the redundant second seed by setting
done_bucket_id: 2on the initial view create and pinning bucket IDs via{increment}.