fix: clarify completed habit reset notice
ci / docker (push) Successful in 4m5s

This commit is contained in:
2026-09-08 10:52:56 +08:00
parent c8abb75cf4
commit 8fa0418fa2
3 changed files with 16 additions and 3 deletions
+8 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { calendarModeLabel, clampFabPosition, countdownDayText, countdownKindLabel, dateKey, defaultView, habitButtonValue, habitWeek, isFabDrag, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, nextTotalAfterLocalTaskAdd, numericHabitInputValue, previousHabitSwipeValue, quickTaskFields, readCountdownCache, readHabitGridCache, shouldToggleRowSwipe, writeCountdownCache, writeHabitGridCache } from './mvp-utils'
import { calendarModeLabel, clampFabPosition, countdownDayText, countdownKindLabel, dateKey, defaultView, habitButtonNotice, habitButtonValue, habitWeek, isFabDrag, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, nextTotalAfterLocalTaskAdd, numericHabitInputValue, previousHabitSwipeValue, quickTaskFields, readCountdownCache, readHabitGridCache, shouldToggleRowSwipe, writeCountdownCache, writeHabitGridCache } from './mvp-utils'
describe('MVP view utilities', () => {
it('formats a local date as YYYY-MM-DD', () => {
@@ -70,6 +70,13 @@ describe('MVP view utilities', () => {
expect(habitButtonValue('boolean', 1, 1)).toBe(0)
})
it('uses reset wording when a completed numeric habit button returns to zero', () => {
expect(habitButtonNotice('numeric', 3, 0)).toBe('今日进度已重置')
expect(habitButtonNotice('numeric', 2, 3)).toBe('已记录一次 🎉')
expect(habitButtonNotice('numeric', 2, 1)).toBe('已减少一次')
expect(habitButtonNotice('boolean', 1, 0)).toBe('已取消完成')
})
it('reuses the current week habit grid while refreshing in the background', () => {
const habits = [{ id: 'habit-1', name: '喝水' }]
writeHabitGridCache('2026-09-07', habits)