Skip to content

Commit

Permalink
Added missing test for bootstrap3
Browse files Browse the repository at this point in the history
  • Loading branch information
zaxovaiko committed Apr 19, 2024
1 parent 38476ab commit f955d8f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 307 deletions.
2 changes: 1 addition & 1 deletion packages/uniforms-bootstrap3/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ describe('@RTL', () => {
suites.testTextField(theme.TextField, { testWrapClassName: true });
suites.testValidatedForm(theme.ValidatedForm);
suites.testValidatedQuickForm(theme.ValidatedQuickForm);
suites.testWrapField(theme.wrapField);
suites.testWrapField(theme.wrapField, { feedbackable: true });
});
84 changes: 0 additions & 84 deletions packages/uniforms-bootstrap3/__tests__/wrapField.tsx

This file was deleted.

76 changes: 0 additions & 76 deletions packages/uniforms-bootstrap4/__tests__/wrapField.tsx

This file was deleted.

76 changes: 0 additions & 76 deletions packages/uniforms-bootstrap5/__tests__/wrapField.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions packages/uniforms-material/__tests__/wrapField.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions packages/uniforms-mui/__tests__/wrapField.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions packages/uniforms/__suites__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export * from './NestField';
export * from './NumField';
export * from './QuickForm';
export * from './RadioField';
export * from './render-zod';
export * from './render';
export * from './SelectField';
export * from './SubmitField';
export * from './TextField';
Expand Down
20 changes: 20 additions & 0 deletions packages/uniforms/__suites__/wrapField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,28 @@ export function testWrapField(
wrapField: (wrapperProps: any, children: ReactNode) => ReactElement,
options?: {
skipForMUI?: boolean;
feedbackable?: boolean;
},
) {
skipTestIf(!options?.feedbackable)(
'<wrapField> - renders wrapper with (feedbackable=true)',
() => {
const error = new Error();
renderWithZod({
element: wrapField(
{ error, feedbackable: true },
<div data-testid="x" />,
),
schema: z.object({}),
});
const x = screen.getByTestId('x');
expect(x.parentElement?.classList.contains('has-feedback')).toBe(true);
expect(
x.nextElementSibling?.classList.contains('form-control-feedback'),
).toBe(true);
},
);

skipTestIf(!options?.skipForMUI)('<wrapField> - renders wrapper', () => {
renderWithZod({
element: wrapField({}, <div data-testid="x" />),
Expand Down

0 comments on commit f955d8f

Please sign in to comment.