feat: collapse subtasks from parent rows
ci / docker (push) Successful in 4m16s

This commit is contained in:
2026-09-08 10:31:31 +08:00
parent 3528e880f6
commit c8abb75cf4
4 changed files with 31 additions and 4 deletions
+7
View File
@@ -8,6 +8,7 @@ type SearchTask = {
parent_id?: string | null
completed?: boolean
list_name?: string
subtasks?: SearchTask[]
}
const tasks: SearchTask[] = [
@@ -26,6 +27,12 @@ describe('task utilities', () => {
expect(groupTaskTree(tasks)).toEqual([{ task: tasks[0], subtasks: [tasks[1]] }, { task: tasks[2], subtasks: [] }])
})
it('preserves subtasks already nested by the task API', () => {
const child: SearchTask = { id: 'nested-child', title: 'Nested child', parent_id: 'nested-parent' }
const parent: SearchTask = { id: 'nested-parent', title: 'Nested parent', parent_id: null, subtasks: [child] }
expect(groupTaskTree([parent])).toEqual([{ task: parent, subtasks: [child] }])
})
it('moves an item before or after another item without changing other scopes', () => {
const rows = [
{ id: 'a', parent_id: null },