fix: reorder visible habits
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { applyMarkdownFormat, buildTaskRecurrencePayload, buildTaskRrule, classifyTaskForToday, defaultTaskDueAt, filterTasks, groupTaskTree, isSameTaskSortTier, moveItemWithinScope, parseTaskRecurrence, parseTaskRrule, renderMarkdown, toDateTimeLocal } from './task-utils'
|
||||
import { applyMarkdownFormat, buildTaskRecurrencePayload, buildTaskRrule, classifyTaskForToday, defaultTaskDueAt, filterTasks, groupTaskTree, isSameTaskSortTier, mergeReorderedSubset, moveItemWithinScope, parseTaskRecurrence, parseTaskRrule, renderMarkdown, toDateTimeLocal } from './task-utils'
|
||||
|
||||
type SearchTask = {
|
||||
id: string
|
||||
@@ -64,6 +64,13 @@ describe('task utilities', () => {
|
||||
expect(moveItemWithinScope(rows, 'a1', 'b', 'before')).toEqual(rows)
|
||||
})
|
||||
|
||||
it('merges a reordered visible subset without moving hidden slots', () => {
|
||||
const rows = [{ id: 'a' }, { id: 'hidden-x' }, { id: 'hidden-y' }, { id: 'b' }]
|
||||
expect(mergeReorderedSubset(rows, [rows[3], rows[0]]).map((row) => row.id)).toEqual([
|
||||
'b', 'hidden-x', 'hidden-y', 'a',
|
||||
])
|
||||
})
|
||||
|
||||
it('builds and parses custom repeat rules like TickTick', () => {
|
||||
expect(buildTaskRrule({ frequency: 'weekly', interval: 2, weekdays: ['MO', 'WE', 'FR'], endMode: 'never' })).toBe('FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE,FR')
|
||||
expect(buildTaskRrule({ frequency: 'monthly', interval: 1, monthDays: [1, 15, 31], endMode: 'count', count: 10 })).toBe('FREQ=MONTHLY;BYMONTHDAY=1,15,31;COUNT=10')
|
||||
|
||||
Reference in New Issue
Block a user