mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
0dd07befa7
The Plan tab was the last trip tab still in the old design. It now reads like Bookings, Costs, Lists, Files and Collab, without losing a function: - Day plan: each day is a card with a head band (day tile with weather, stay and rental pills, a "+" menu for place, stay, transport, transit and note), rows with "..." menus, white badges and a white route bar. - Places column: add, search and filters in three rows, a show dropdown, category and rating filters, and a selection bar at the foot. - Place inspector, day details and the stay editor on the shared dialog frame; the place form in the editor look with the name in the head band. - Clicking a booking or transport anywhere on the plan opens the booking detail popup first; Edit leads to the editor. The popup is one host shared with the Bookings and Transports tabs. - Files and Collab dialogs, notes, polls, links and chat moved to the same frame; shared DialogShell and dialogParts hold the building blocks. - The map hover card shows the place photo and follows the theme. Every new and reworded string is translated into all locales, and a few older English leftovers (help center, cost split, import hints) with them. Phone screens keep their own look.
48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
// FE-PLANNER-TIMECONFIRM-001 to FE-PLANNER-TIMECONFIRM-004
|
|
import { render, screen } from '../../../tests/helpers/render'
|
|
import userEvent from '@testing-library/user-event'
|
|
import { DayPlanSidebarTimeConfirmModal } from './DayPlanSidebarTimeConfirmModal'
|
|
|
|
const t = (key: string, params?: Record<string, unknown>) =>
|
|
params ? `${key}|${Object.values(params).join('|')}` : key
|
|
|
|
const pending = { dayId: 10, fromId: 22, time: '14:00' }
|
|
|
|
function setup(timeConfirm: typeof pending | null = pending) {
|
|
const setTimeConfirm = vi.fn()
|
|
const confirmTimeRemoval = vi.fn()
|
|
render(<DayPlanSidebarTimeConfirmModal timeConfirm={timeConfirm} setTimeConfirm={setTimeConfirm} confirmTimeRemoval={confirmTimeRemoval} t={t} />)
|
|
return { setTimeConfirm, confirmTimeRemoval }
|
|
}
|
|
|
|
describe('DayPlanSidebarTimeConfirmModal', () => {
|
|
it('FE-PLANNER-TIMECONFIRM-001: nothing pending, nothing asked', () => {
|
|
setup(null)
|
|
expect(screen.queryByText('dayplan.confirmRemoveTimeTitle')).not.toBeInTheDocument()
|
|
})
|
|
|
|
it('FE-PLANNER-TIMECONFIRM-002: asks with the time that would be dropped', () => {
|
|
setup()
|
|
expect(screen.getByText('dayplan.confirmRemoveTimeTitle')).toBeInTheDocument()
|
|
expect(screen.getByText('dayplan.confirmRemoveTimeBody|14:00')).toBeInTheDocument()
|
|
})
|
|
|
|
it('FE-PLANNER-TIMECONFIRM-003: Confirm removes the time, Cancel leaves it', async () => {
|
|
const user = userEvent.setup()
|
|
const s = setup()
|
|
await user.click(screen.getByRole('button', { name: 'common.cancel' }))
|
|
expect(s.setTimeConfirm).toHaveBeenCalledWith(null)
|
|
expect(s.confirmTimeRemoval).not.toHaveBeenCalled()
|
|
await user.click(screen.getByRole('button', { name: /confirm/i }))
|
|
expect(s.confirmTimeRemoval).toHaveBeenCalledTimes(1)
|
|
})
|
|
|
|
it('FE-PLANNER-TIMECONFIRM-004: Escape takes the question back', async () => {
|
|
const user = userEvent.setup()
|
|
const s = setup()
|
|
await user.keyboard('{Escape}')
|
|
expect(s.setTimeConfirm).toHaveBeenCalledWith(null)
|
|
expect(s.confirmTimeRemoval).not.toHaveBeenCalled()
|
|
})
|
|
})
|