fix(i18n): identify Bokmål accurately in supported-language controls

This commit is contained in:
cesnimda
2026-11-02 23:24:15 +01:00
parent 1756273bc1
commit d3d3383764
6 changed files with 27 additions and 3 deletions
@@ -24,6 +24,17 @@ function Providers({ children }: { children: React.ReactNode }) {
afterEach(() => localStorage.clear());
test('language controls identify Bokmål with its native name and language code', () => {
render(<Providers><AppShell pageTitle="Jobs" breadcrumbs={[]} pathname="/jobs" nav={nav} navBottom={[]} onNavigate={jest.fn()} onToggleDrawer={jest.fn()} drawerOpen={false}><div>Jobs content</div></AppShell></Providers>);
const bokmal = screen.getAllByRole('button', { name: 'Norsk bokmål' })[0];
expect(bokmal).toHaveTextContent('NB');
expect(bokmal).toHaveAttribute('lang', 'nb');
expect(screen.getAllByRole('button', { name: 'English' })[0]).toHaveAttribute('lang', 'en');
fireEvent.click(bokmal);
expect(bokmal).toHaveAttribute('aria-pressed', 'true');
expect(localStorage.getItem('uiLanguage')).toBe('nb');
});
test("[P5-01 PRES-E07 E08] grouped navigation exposes the current child without marking the parent as the page", () => {
render(<Providers><AppShell pageTitle="Board" breadcrumbs={[]} pathname="/kanban" nav={nav} navBottom={[]} onNavigate={jest.fn()} onToggleDrawer={jest.fn()} drawerOpen={false}><div>Board content</div></AppShell></Providers>);
expect(screen.getByRole("navigation", { name: "Navigation" })).toBeInTheDocument();