| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié --------- Co-authored-by: admin malio <malio@yuno.malio.fr> Co-authored-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr> Co-authored-by: matthieu <matthieu@yuno.malio.fr> Reviewed-on: #84 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #84.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'
|
||||
import {ref} from 'vue'
|
||||
import {nextTick, ref} from 'vue'
|
||||
import {useCalendarView} from './useCalendarView'
|
||||
|
||||
describe('useCalendarView', () => {
|
||||
@@ -65,4 +65,27 @@ describe('useCalendarView', () => {
|
||||
expect(currentMonth.value).toBe(4)
|
||||
expect(currentYear.value).toBe(2026)
|
||||
})
|
||||
|
||||
it('paginates years by 12 in years view', () => {
|
||||
const {yearPageStart, goToNext, goToPrev} = useCalendarView(ref('years'))
|
||||
const start = yearPageStart.value
|
||||
goToNext()
|
||||
expect(yearPageStart.value).toBe(start + 12)
|
||||
goToPrev()
|
||||
expect(yearPageStart.value).toBe(start)
|
||||
})
|
||||
|
||||
it('selectYear sets the current year', () => {
|
||||
const {currentYear, selectYear} = useCalendarView(ref('days'))
|
||||
selectYear(2030)
|
||||
expect(currentYear.value).toBe(2030)
|
||||
})
|
||||
|
||||
it('recenters the year page on entering years view (current - 4)', async () => {
|
||||
const mode = ref<'days' | 'months' | 'years'>('days')
|
||||
const {yearPageStart} = useCalendarView(mode)
|
||||
mode.value = 'years'
|
||||
await nextTick()
|
||||
expect(yearPageStart.value).toBe(2022) // 2026 - 4 (année courante en 2e ligne / 2e col)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user