Skip to content

Commit

Permalink
fixup! πŸ“Œ(deps) unpin react & react-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
jbpenrath committed Dec 2, 2022
1 parent 5b98c64 commit d4a1132
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions examples/poll/src/components/Modal/AddQuestionModal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,26 @@ describe('AddQuestionModal', () => {

beforeEach(() => {
useVernaValue = undefined;
document.body.innerHTML = '';
});

it('should be able to add a widget from the list with correct type and name', async () => {
render(<VernaSuspenseWrapper idParts={['root', 'testSection']} />);

// Wait that the form is rendered...
await waitFor(() => {
expect(screen.queryByTestId('suspense-fallback')).toBeNull();
await waitFor(async () => {
expect(screen.queryByTestId('suspense-fallback')).not.toBeInTheDocument();
// Check that the modal is rendered
screen.getByText('Select a type of question to add');
});

// Check that the modal is rendered
expect(screen.getByText('Select a type of question to add')).toBeInTheDocument();

// Add a Multiple choice question field
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: 'Open Drop' }));
await userEvent.click(screen.getByRole('option', { name: 'Single choice question' }));
await userEvent.click(screen.getByRole('button', { name: 'Add' }));
});
await userEvent.click(screen.getByRole('button', { name: 'Open Drop' }));
await userEvent.click(screen.getByRole('option', { name: 'Single choice question' }));
await userEvent.click(screen.getByRole('button', { name: 'Add' }));

// Open parameters of the newly created field and add an option
await act(async () => {
await waitFor(async () => {
await userEvent.click(screen.getAllByRole('button', { name: 'Parameters' })[3]);
await userEvent.click(screen.getAllByRole('button', { name: 'Add' })[0]);
await userEvent.type(screen.getAllByRole('textbox', {})[1], 'test');
Expand Down Expand Up @@ -101,11 +99,9 @@ describe('AddQuestionModal', () => {
});

// Add a Multiple choice question field
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: 'Open Drop' }));
await userEvent.click(screen.getByRole('option', { name: 'Single choice question' }));
await userEvent.click(screen.getByRole('button', { name: 'Add' }));
});
await userEvent.click(screen.getByRole('button', { name: 'Open Drop' }));
await userEvent.click(screen.getByRole('option', { name: 'Single choice question' }));
await userEvent.click(screen.getByRole('button', { name: 'Add' }));

// Check that the newly created widget is well initialized
const { formSchema, uiSchema } = useVernaValue!;
Expand Down

0 comments on commit d4a1132

Please sign in to comment.