This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { dateKey, defaultView, habitWeek, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, numericHabitInputValue, previousHabitSwipeValue, quickTaskFields, shouldToggleRowSwipe } from './mvp-utils'
|
||||
import { 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', () => {
|
||||
@@ -63,6 +63,15 @@ describe('MVP view utilities', () => {
|
||||
expect(previousHabitSwipeValue('numeric', 0)).toBe(0)
|
||||
})
|
||||
|
||||
it('renders countdown labels from date-only day values', () => {
|
||||
expect(countdownDayText(8)).toBe('还有 8 天')
|
||||
expect(countdownDayText(0)).toBe('就是今天')
|
||||
expect(countdownDayText(-12)).toBe('已经 12 天')
|
||||
expect(countdownKindLabel('countdown')).toBe('倒数日')
|
||||
expect(countdownKindLabel('anniversary')).toBe('纪念日')
|
||||
expect(countdownKindLabel('birthday')).toBe('生日')
|
||||
})
|
||||
|
||||
it('toggles a row for a deliberate mostly-horizontal swipe', () => {
|
||||
expect(shouldToggleRowSwipe(78, 8)).toBe(true)
|
||||
expect(shouldToggleRowSwipe(88, 28)).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user