fix: reorder visible habits
ci / gitleaks (push) Successful in 8s
ci / docker (push) Successful in 7m45s

This commit is contained in:
2026-09-15 15:14:55 +08:00
parent fa11e5f432
commit 51761f7615
4 changed files with 29 additions and 10 deletions
+7 -3
View File
@@ -750,13 +750,17 @@ describe('task and habit row decoration', () => {
expect(css).not.toContain('.habit-toolbar{')
})
it('filters habits with the shared preference and disables sorting while completed items are hidden', () => {
it('filters habits with the shared preference while keeping visible habits sortable', () => {
expect(mvpPanel).toContain('const visibleTodayHabits = computed(() => props.showCompleted ? todayHabits.value')
expect(mvpPanel).toContain('const visibleHabits = computed(() => props.showCompleted ? habits.value')
expect(mvpPanel).toContain('v-for="h in visibleTodayHabits"')
expect(mvpPanel).toContain('v-for="h in visibleHabits"')
expect(mvpPanel).toContain(':disabled="!showCompleted"')
expect(mvpPanel).toContain('if (busy.value || !props.showCompleted) return')
expect(mvpPanel).not.toContain(':disabled="!showCompleted"')
expect(mvpPanel).toContain('if (busy.value) return')
expect(mvpPanel).not.toContain('if (busy.value || !props.showCompleted) return')
expect(mvpPanel).toContain('const reorderedVisible = moveItemWithinScope(visiblePrevious')
expect(mvpPanel).toContain('const next = mergeReorderedSubset(previous, reorderedVisible)')
expect(mvpPanel).toContain('habit_ids: reorderedVisible.map((item) => item.id)')
expect(css).not.toContain('.habit-toolbar{')
})