This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { countdownDayText, countdownKindLabel, dateKey, defaultView, habitWeek, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, numericHabitInputValue, previousHabitSwipeValue, quickTaskFields, shouldToggleRowSwipe } from './mvp-utils'
|
||||
import { calendarModeLabel, countdownDayText, countdownKindLabel, dateKey, defaultView, habitWeek, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, numericHabitInputValue, previousHabitSwipeValue, quickTaskFields, shouldToggleRowSwipe } from './mvp-utils'
|
||||
|
||||
describe('MVP view utilities', () => {
|
||||
it('formats a local date as YYYY-MM-DD', () => {
|
||||
@@ -70,6 +70,8 @@ describe('MVP view utilities', () => {
|
||||
expect(countdownKindLabel('countdown')).toBe('倒数日')
|
||||
expect(countdownKindLabel('anniversary')).toBe('纪念日')
|
||||
expect(countdownKindLabel('birthday')).toBe('生日')
|
||||
expect(calendarModeLabel('solar')).toBe('公历')
|
||||
expect(calendarModeLabel('lunar')).toBe('农历')
|
||||
})
|
||||
|
||||
it('toggles a row for a deliberate mostly-horizontal swipe', () => {
|
||||
|
||||
@@ -86,6 +86,10 @@ export function countdownKindLabel(kind: string) {
|
||||
return ({ countdown: '倒数日', anniversary: '纪念日', birthday: '生日' } as Record<string, string>)[kind] ?? '倒数日'
|
||||
}
|
||||
|
||||
export function calendarModeLabel(mode: string) {
|
||||
return mode === 'lunar' ? '农历' : '公历'
|
||||
}
|
||||
|
||||
export function shouldToggleRowSwipe(deltaX: number, deltaY: number) {
|
||||
return deltaX >= 64 && deltaX > Math.abs(deltaY) * 1.5
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user