Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrpospiech committed Feb 15, 2024
1 parent 0acc523 commit 02b44d1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/uniforms/__suites__/ListField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,42 @@ export function testListField(
test('<ListField> - renders correct error style', () => {
const error = new Error();

const { container } = render(
<ListField name="x" label="ListFieldLabel" error={error} />,
render(
<ListField
name="x"
label="ListFieldLabel"
error={error}
data-testid="field"
/>,
{
x: Array,
'x.$': String,
},
);

expect(container.getElementsByClassName('ant-list')[0]).toHaveStyle(
expect(screen.getByTestId('field')).toHaveStyle(
'borderColor: rgb(255, 85, 0)',
);
});

test('<ListField> - renders correct error style (with specified style prop)', () => {
const error = new Error();

const { container } = render(
render(
<ListField
name="x"
label="ListFieldLabel"
error={error}
style={{ marginLeft: '8px' }}
data-testid="field"
/>,
{
x: Array,
'x.$': String,
},
);

expect(container.getElementsByClassName('ant-list')[0]).toHaveStyle(
'marginLeft: 8px',
);
expect(screen.getByTestId('field')).toHaveStyle('marginLeft: 8px');
});
}

Expand Down Expand Up @@ -141,7 +145,7 @@ export function testListField(
});

test('<ListField> - renders children with correct name (children)', () => {
const Child = jest.fn(() => <div data-testid="field" />) as FC<any>;
const Child = jest.fn(() => <div />) as FC<any>;
render(
<ListField name="x">
<Child name="$" />
Expand Down

0 comments on commit 02b44d1

Please sign in to comment.