mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 17:41:51 +00:00
77dddd5e8a
Release branch for 4.0.0.
39 lines
1.8 KiB
TypeScript
39 lines
1.8 KiB
TypeScript
// FE-MOB-SET-NAV-001 onwards
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import userEvent from '@testing-library/user-event';
|
|
import { render, screen } from '../../../helpers/render';
|
|
import { resetAllStores, seedStore } from '../../../helpers/store';
|
|
import { buildSettings } from '../../../helpers/factories';
|
|
import { useSettingsStore } from '../../../../src/store/settingsStore';
|
|
import { usePluginStore } from '../../../../src/store/pluginStore';
|
|
import MSettings from '../../../../src/mobile/screens/settings/MSettings';
|
|
|
|
describe('MSettings', () => {
|
|
beforeEach(() => {
|
|
resetAllStores();
|
|
seedStore(useSettingsStore, { settings: buildSettings({ language: 'en' }) });
|
|
usePluginStore.setState({ plugins: [], loaded: true });
|
|
});
|
|
|
|
it('FE-MOB-SET-NAV-001: opens on General with the section switcher pill', () => {
|
|
render(<MSettings />, { initialEntries: ['/settings'] });
|
|
|
|
expect(screen.getByRole('button', { name: /General/ })).toBeInTheDocument();
|
|
expect(screen.getByText('Language & region')).toBeInTheDocument();
|
|
});
|
|
|
|
it('FE-MOB-SET-NAV-002: the dropdown lists the sections and switches on tap', async () => {
|
|
const user = userEvent.setup();
|
|
render(<MSettings />, { initialEntries: ['/settings'] });
|
|
|
|
await user.click(screen.getByRole('button', { name: /General/ }));
|
|
expect(screen.getByRole('button', { name: 'Appearance' })).toBeInTheDocument();
|
|
expect(screen.getByRole('button', { name: 'Account' })).toBeInTheDocument();
|
|
|
|
await user.click(screen.getByRole('button', { name: 'Notifications' }));
|
|
// Pill now shows the active section; the General card is gone.
|
|
expect(screen.getByRole('button', { name: /Notifications/ })).toBeInTheDocument();
|
|
expect(screen.queryByText('Language & region')).not.toBeInTheDocument();
|
|
});
|
|
});
|