Skip to content

Commit

Permalink
enabled and fixed MUI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrpospiech committed Oct 26, 2024
1 parent d0fe9b5 commit dbd46be
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/uniforms-mui/__tests__/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderWithZod } from 'uniforms/__suites__';
import { DateField } from 'uniforms-mui';
import { z } from 'zod';

describe.skip('@RTL - DateField tests', () => {
describe('@RTL - DateField tests', () => {
test('<DateField> - renders a Input with correct error text (specified)', () => {
const error = new Error();
renderWithZod({
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-mui/__tests__/NestField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderWithZod } from 'uniforms/__suites__';
import { NestField } from 'uniforms-mui';
import { z } from 'zod';

describe.skip('@RTL - NestField tests', () => {
describe('@RTL - NestField tests', () => {
test('<NestField> - renders a label (required annotation)', () => {
const { container } = renderWithZod({
element: <NestField name="x" label="y" />,
Expand Down
54 changes: 27 additions & 27 deletions packages/uniforms-mui/__tests__/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderWithZod } from 'uniforms/__suites__';
import { SelectField } from 'uniforms-mui';
import { z } from 'zod';

describe.skip('@RTL - SelectField tests', () => {
describe('@RTL - SelectField tests', () => {
test('<SelectField> - renders a Select with correct disabled state', () => {
renderWithZod({
element: <SelectField data-testid="select-field" name="x" disabled />,
Expand All @@ -22,7 +22,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('X *')).toBeInTheDocument();
expect(screen.getByText('X *')).toBeInTheDocument();
});

test('<SelectField> - renders a Select with correct options', () => {
Expand All @@ -32,7 +32,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(selectOptions) }),
});

fireEvent.mouseDown(screen.getByRole('button'));
fireEvent.mouseDown(screen.getByRole('combobox'));
const listbox = within(screen.getByRole('listbox'));

selectOptions.forEach(option => {
Expand All @@ -49,7 +49,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.string() }),
});

fireEvent.mouseDown(screen.getByRole('button'));
fireEvent.mouseDown(screen.getByRole('combobox'));
const listbox = within(screen.getByRole('listbox'));

selectOptions.forEach(option => {
Expand Down Expand Up @@ -110,7 +110,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

fireEvent.mouseDown(screen.getByRole('button'));
fireEvent.mouseDown(screen.getByRole('combobox'));
const listbox = within(screen.getByRole('listbox'));
fireEvent.click(listbox.getByText(/b/i));

Expand All @@ -125,7 +125,7 @@ describe.skip('@RTL - SelectField tests', () => {
model: { x: 'b' },
});

fireEvent.mouseDown(screen.getByRole('button'));
fireEvent.mouseDown(screen.getByRole('combobox'));
const listbox = within(screen.getByRole('listbox'));

fireEvent.click(listbox.getByText(/b/i));
Expand All @@ -139,7 +139,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['ă', 'ś']) }),
});

fireEvent.mouseDown(screen.getByRole('button'));
fireEvent.mouseDown(screen.getByRole('combobox'));
const listbox = within(screen.getByRole('listbox'));

expect(listbox.getByText('ă')).toBeInTheDocument();
Expand All @@ -160,7 +160,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

fireEvent.mouseDown(screen.getByRole('button'));
fireEvent.mouseDown(screen.getByRole('combobox'));
const listbox = within(screen.getByRole('listbox'));

expect(listbox.getByText('A')).toHaveClass('Mui-disabled');
Expand Down Expand Up @@ -193,8 +193,8 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('a')).toBeDisabled();
expect(screen.getByLabelText('b')).toBeDisabled();
expect(screen.getByLabelText('a *')).toBeDisabled();
expect(screen.getByLabelText('b *')).toBeDisabled();
});

test('<SelectField checkboxes> - renders a set of Radio buttons with correct id (inherited)', () => {
Expand All @@ -203,8 +203,8 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('a')).toHaveAttribute('id');
expect(screen.getByLabelText('b')).toHaveAttribute('id');
expect(screen.getByLabelText('a *')).toHaveAttribute('id');
expect(screen.getByLabelText('b *')).toHaveAttribute('id');
});

test('<SelectField checkboxes> - renders a set of Radio buttons with correct id (specified)', () => {
Expand All @@ -213,8 +213,8 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('a')).toHaveAttribute('id', 'y-YQ');
expect(screen.getByLabelText('b')).toHaveAttribute('id', 'y-Yg');
expect(screen.getByLabelText('a *')).toHaveAttribute('id', 'y-YQ');
expect(screen.getByLabelText('b *')).toHaveAttribute('id', 'y-Yg');
});

test('<SelectField checkboxes> - renders a set of Radio buttons with correct name', () => {
Expand All @@ -223,8 +223,8 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('a')).toHaveAttribute('name', 'x');
expect(screen.getByLabelText('b')).toHaveAttribute('name', 'x');
expect(screen.getByLabelText('a *')).toHaveAttribute('name', 'x');
expect(screen.getByLabelText('b *')).toHaveAttribute('name', 'x');
});

test('<SelectField checkboxes> - renders a set of Radio buttons with correct value (default)', () => {
Expand All @@ -233,8 +233,8 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('a')).toBeChecked();
expect(screen.getByLabelText('b')).not.toBeChecked();
expect(screen.getByLabelText('a *')).toBeChecked();
expect(screen.getByLabelText('b *')).not.toBeChecked();
});

test('<SelectField checkboxes> - renders a set of Radio buttons with correct value (model)', () => {
Expand All @@ -244,8 +244,8 @@ describe.skip('@RTL - SelectField tests', () => {
model: { x: 'b' },
});

expect(screen.getByLabelText('a')).not.toBeChecked();
expect(screen.getByLabelText('b')).toBeChecked();
expect(screen.getByLabelText('a *')).not.toBeChecked();
expect(screen.getByLabelText('b *')).toBeChecked();
});

test('<SelectField checkboxes> - renders a set of Radio buttons with correct value (specified)', () => {
Expand All @@ -254,8 +254,8 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

expect(screen.getByLabelText('a')).not.toBeChecked();
expect(screen.getByLabelText('b')).toBeChecked();
expect(screen.getByLabelText('a *')).not.toBeChecked();
expect(screen.getByLabelText('b *')).toBeChecked();
});

test('<SelectField checkboxes> - renders a set of Radio buttons which correctly reacts on change', () => {
Expand All @@ -266,7 +266,7 @@ describe.skip('@RTL - SelectField tests', () => {
schema: z.object({ x: z.enum(['a', 'b']) }),
});

fireEvent.click(screen.getByLabelText('b'));
fireEvent.click(screen.getByLabelText('b *'));

expect(onChange).toHaveBeenCalledWith('b');
});
Expand All @@ -285,8 +285,8 @@ describe.skip('@RTL - SelectField tests', () => {
}),
});

expect(screen.getByLabelText('A')).toBeInTheDocument();
expect(screen.getByLabelText('B')).toBeInTheDocument();
expect(screen.getByLabelText('A *')).toBeInTheDocument();
expect(screen.getByLabelText('B *')).toBeInTheDocument();
});

test('<SelectField checkboxes> - renders a SelectField with correct error text (showInlineError=true)', () => {
Expand Down Expand Up @@ -377,7 +377,7 @@ describe.skip('@RTL - SelectField tests', () => {
}),
});

expect(screen.getByLabelText('A')).toBeDisabled();
expect(screen.getByLabelText('B')).not.toBeDisabled();
expect(screen.getByLabelText('A *')).toBeDisabled();
expect(screen.getByLabelText('B *')).not.toBeDisabled();
});
});
2 changes: 1 addition & 1 deletion packages/uniforms-mui/__tests__/wrapField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderWithZod } from 'uniforms/__suites__';
import { wrapField } from 'uniforms-mui';
import { z } from 'zod';

describe.skip('wrapField tests', () => {
describe('wrapField tests', () => {
test('<wrapField> - renders wrapper', () => {
renderWithZod({
element: wrapField({}, <div data-testid="x" />),
Expand Down

0 comments on commit dbd46be

Please sign in to comment.