feat(roadtrip): add daily scheduling and configurable day endings

This commit is contained in:
Maurice
2026-09-11 22:28:02 +02:00
parent 4f8605b529
commit 491cfccc56
124 changed files with 3512 additions and 354 deletions
@@ -0,0 +1,19 @@
import { fireEvent, render, screen, act } from '@testing-library/react'
import { expect, it, vi } from 'vitest'
import EndDayControl from './EndDayControl'
vi.mock('../../i18n/TranslationContext', () => ({ useTranslation: () => ({ t: (key: string) => key }) }))
it('shows the saved state and blocks a second click while saving', async () => {
let finish!: () => void
const onToggle = vi.fn(() => new Promise<void>(resolve => { finish = resolve }))
render(<EndDayControl active onToggle={onToggle} />)
const toggle = screen.getByRole('button', { name: 'roadtrip.window.endHere' })
expect(toggle).toHaveAttribute('aria-pressed', 'true')
fireEvent.click(toggle)
expect(toggle).toBeDisabled()
fireEvent.click(toggle)
expect(onToggle).toHaveBeenCalledTimes(1)
await act(async () => finish())
expect(toggle).toBeEnabled()
})