feat(i18n): localise CV builder workflow
This commit is contained in:
@@ -57,11 +57,14 @@ function renderAt(id: number) {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
window.localStorage.removeItem('uiLanguage');
|
||||
jest.clearAllMocks();
|
||||
mockedApi.put.mockReset();
|
||||
mockedApi.post.mockResolvedValue({ data: { themeId: 'nordic', html: '<p>cv</p>', suggestedFileName: 'cv.pdf' } } as any);
|
||||
});
|
||||
|
||||
afterEach(() => window.localStorage.removeItem('uiLanguage'));
|
||||
|
||||
function routeGet(onVariant: () => Promise<any>, outline: any = { sections: [] }) {
|
||||
mockedApi.get.mockImplementation((url: string) => {
|
||||
if (url === '/cv/variants/3') return onVariant();
|
||||
@@ -158,6 +161,22 @@ test('professional editor separates template, design and layout controls', async
|
||||
expect(screen.getByLabelText('Language')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('editor sections, design controls and document settings render in Bokmål', async () => {
|
||||
window.localStorage.setItem('uiLanguage', 'nb');
|
||||
routeGet(() => Promise.resolve({ data: variant } as any));
|
||||
renderAt(3);
|
||||
|
||||
expect(await screen.findByLabelText('Egen overskrift')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Utvid Erfaring' })).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Seksjonstype')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('tab', { name: 'Design' }));
|
||||
expect(screen.getByText('Typografi')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Visning av ferdigheter')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('tab', { name: 'Oppsett' }));
|
||||
expect(screen.getByLabelText('Sidestørrelse')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Dokumentspråk')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('internal navigation warns and can be cancelled before discarding a pending edit', async () => {
|
||||
routeGet(() => Promise.resolve({ data: variant } as any));
|
||||
renderAt(3);
|
||||
|
||||
Reference in New Issue
Block a user