feat : viewMode 3 niveaux + goToHigherView (#date-year-picker)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 09:59:06 +02:00
parent 7ea1292e2a
commit f7fc54c070
2 changed files with 13 additions and 9 deletions
@@ -30,19 +30,21 @@ describe('useCalendarPopover', () => {
expect(api.viewMode.value).toBe('days')
})
it('toggleView() switches between days and months', () => {
it('goToHigherView() climbs days -> months -> years and stops', () => {
const {api} = mountHost()
api.open()
api.toggleView()
api.goToHigherView()
expect(api.viewMode.value).toBe('months')
api.toggleView()
expect(api.viewMode.value).toBe('days')
api.goToHigherView()
expect(api.viewMode.value).toBe('years')
api.goToHigherView()
expect(api.viewMode.value).toBe('years') // no-op au niveau le plus haut
})
it('close() resets isOpen and viewMode', () => {
const {api} = mountHost()
api.open()
api.toggleView()
api.goToHigherView()
api.close()
expect(api.isOpen.value).toBe(false)
expect(api.viewMode.value).toBe('days')