fix: collapse upcoming task subtasks by default
This commit is contained in:
@@ -343,7 +343,7 @@ async function loadRestoredView() {
|
|||||||
if (activeView.value === 'trash') await loadTrash()
|
if (activeView.value === 'trash') await loadTrash()
|
||||||
else if (isTaskView(activeView.value)) {
|
else if (isTaskView(activeView.value)) {
|
||||||
await loadAll()
|
await loadAll()
|
||||||
if (activeView.value === 'tasks') collapseLoadedTaskChildren()
|
if (activeView.value === 'tasks' || activeView.value === 'upcoming') collapseLoadedTaskChildren()
|
||||||
}
|
}
|
||||||
else { tasks.value = []; totalTasks.value = 0 }
|
else { tasks.value = []; totalTasks.value = 0 }
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ async function switchView(view: View, listId?: string) {
|
|||||||
else if (!isTaskView(view)) tasks.value = []
|
else if (!isTaskView(view)) tasks.value = []
|
||||||
else {
|
else {
|
||||||
await loadAll()
|
await loadAll()
|
||||||
if (view === 'tasks') collapseLoadedTaskChildren()
|
if (view === 'tasks' || view === 'upcoming') collapseLoadedTaskChildren()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function loadTodayView() {
|
async function loadTodayView() {
|
||||||
|
|||||||
@@ -209,10 +209,10 @@ describe('task and habit row decoration', () => {
|
|||||||
expect(app).toContain(':aria-expanded="!collapsedTaskIds.has(node.task.id)"')
|
expect(app).toContain(':aria-expanded="!collapsedTaskIds.has(node.task.id)"')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('starts parent tasks collapsed when entering a task list', () => {
|
it('starts parent tasks collapsed when entering a task list or upcoming view', () => {
|
||||||
expect(app).toContain('function collapseLoadedTaskChildren()')
|
expect(app).toContain('function collapseLoadedTaskChildren()')
|
||||||
expect(app).toContain("else if (isTaskView(activeView.value)) {\n await loadAll()\n if (activeView.value === 'tasks') collapseLoadedTaskChildren()")
|
expect(app).toContain("else if (isTaskView(activeView.value)) {\n await loadAll()\n if (activeView.value === 'tasks' || activeView.value === 'upcoming') collapseLoadedTaskChildren()")
|
||||||
expect(app).toContain("else {\n await loadAll()\n if (view === 'tasks') collapseLoadedTaskChildren()")
|
expect(app).toContain("else {\n await loadAll()\n if (view === 'tasks' || view === 'upcoming') collapseLoadedTaskChildren()")
|
||||||
expect(app).toContain('tasks.value.filter((task) => task.subtasks?.length).map((task) => task.id)')
|
expect(app).toContain('tasks.value.filter((task) => task.subtasks?.length).map((task) => task.id)')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user