Wizard: Add Locale to Review step

This adds Locale expandable to the Review step.
This commit is contained in:
regexowl 2024-12-09 14:40:02 +01:00 committed by Lucas Garfield
parent 3dcafd5672
commit 8d84b5eef2
3 changed files with 74 additions and 2 deletions

View file

@ -1,5 +1,5 @@
import type { Router as RemixRouter } from '@remix-run/router';
import { screen, waitFor } from '@testing-library/react';
import { screen, waitFor, within } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
@ -86,6 +86,13 @@ const selectKeyboard = async () => {
await waitFor(() => user.click(usKeyboard));
};
const clickRevisitButton = async () => {
const user = userEvent.setup();
const expandable = await screen.findByTestId('locale-expandable');
const revisitButton = await within(expandable).findByTestId('revisit-locale');
await waitFor(() => user.click(revisitButton));
};
describe('Step Locale', () => {
beforeEach(() => {
vi.clearAllMocks();
@ -140,6 +147,16 @@ describe('Step Locale', () => {
expect(options[1]).toHaveTextContent('us-acentos');
expect(options[2]).toHaveTextContent('us-alt-intl');
});
test('revisit step button on Review works', async () => {
await renderCreateMode();
await goToLocaleStep();
await searchForKeyboard();
await selectKeyboard();
await goToReviewStep();
await clickRevisitButton();
await screen.findByRole('heading', { name: /Locale/ });
});
});
describe('Locale request generated correctly', () => {
@ -232,4 +249,5 @@ describe('Locale edit mode', () => {
});
});
// TO DO 'Step Locale' -> 'revisit step button on Review works'
// TO DO 'with languages selected'
// TO DO 'with languages and keyboard selected'