Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrpospiech committed Feb 16, 2024
1 parent bddbe12 commit 7c46bb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/uniforms-antd/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('@RTL', () => {
getListAddField: screen => screen.getByRole('img', { name: 'plus-square' }),
});
suites.testListItemField(theme.ListItemField, {
isSelectCombobox: true,
useInputAsSelectField: true,
});
suites.testLongTextField(theme.LongTextField);
Expand Down
10 changes: 10 additions & 0 deletions packages/uniforms/__suites__/ListItemField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { renderWithZod } from './render-zod';
export function testListItemField(
ListItemField: ComponentType<any>,
options?: {
isSelectCombobox?: boolean;
useInputAsSelectField?: boolean;
},
) {
Expand Down Expand Up @@ -46,6 +47,15 @@ export function testListItemField(

if (options?.useInputAsSelectField) {
expect(container.getElementsByTagName('input')).toHaveLength(3);

if (options?.isSelectCombobox) {
expect(screen.getByRole('combobox')).toBeInTheDocument();
} else {
expect(container.getElementsByTagName('input')?.[2]).toHaveAttribute(
'name',
'select',
);
}
} else {
expect(container.getElementsByTagName('input')).toHaveLength(2);
expect(container.getElementsByTagName('select')).toHaveLength(1);
Expand Down

0 comments on commit 7c46bb6

Please sign in to comment.