mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
feat(client): add the Startup section to General settings
Desktop and mobile both get it, in the style of the file they live in - the On/Off button pairs on desktop, segments and a picker sheet on mobile. The tab picker only appears once "Active trip" is chosen, since there is nothing for it to mean otherwise. Labels come from the same keys the planner's tab bar uses, so the picker can never name a tab differently from the tab itself.
This commit is contained in:
@@ -156,4 +156,38 @@ describe('MSettingsGeneral', () => {
|
||||
await user.click(screen.getByRole('button', { name: '°F Fahrenheit' }));
|
||||
await screen.findByText('Error');
|
||||
});
|
||||
|
||||
it('FE-MOB-SET-012: the startup card defaults to the dashboard and hides the tab row', () => {
|
||||
render(<MSettingsGeneral />);
|
||||
|
||||
expect(screen.getByText('Startup')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Dashboard' })).toHaveAttribute('aria-pressed', 'true');
|
||||
expect(screen.queryByText('Start tab')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-SET-013: picking the active trip persists it and reveals the tab row', async () => {
|
||||
const user = userEvent.setup();
|
||||
const updateSetting = vi.fn().mockResolvedValue(undefined);
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ language: 'en' }), updateSetting });
|
||||
render(<MSettingsGeneral />);
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Active trip' }));
|
||||
expect(updateSetting).toHaveBeenCalledWith('start_page', 'active_trip');
|
||||
});
|
||||
|
||||
it('FE-MOB-SET-014: the start-tab sheet saves the planner tab id behind the label', async () => {
|
||||
const user = userEvent.setup();
|
||||
const updateSetting = vi.fn().mockResolvedValue(undefined);
|
||||
seedStore(useSettingsStore, {
|
||||
settings: buildSettings({ language: 'en', start_page: 'active_trip', start_trip_tab: 'plan' }),
|
||||
updateSetting,
|
||||
});
|
||||
render(<MSettingsGeneral />);
|
||||
|
||||
expect(screen.getByText('Start tab')).toBeInTheDocument();
|
||||
await user.click(screen.getByRole('button', { name: 'Plan' }));
|
||||
await user.click(await screen.findByText('Costs'));
|
||||
|
||||
expect(updateSetting).toHaveBeenCalledWith('start_trip_tab', 'finanzplan');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user