Skip to content

Commit

Permalink
Changed default props override test
Browse files Browse the repository at this point in the history
  • Loading branch information
zaxovaiko committed Jun 17, 2024
1 parent 49e2af1 commit 8e61732
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/uniforms-antd/__tests__/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ test('<DateField> - renders an input', () => {
expect(getClosestInput('X')).toBeInTheDocument();
});

test('<DateField> - default props override', () => {
const pickerProps = { name: 'y' };
test('<DateField> - default props override', async () => {
const pickerProps = { showTime: false, style: { background: 'red' } };
renderWithZod({
// @ts-ignore -- passing the same prop for testing purposes
element: <DateField name="x" {...pickerProps} />,
schema: z.object({ y: z.date() }),
schema: z.object({ x: z.date() }),
});
expect(screen.getByText('Y')).toBeInTheDocument();
const body = screen.getByText('X').closest('body');
const input = body?.querySelector('.ant-picker');
expect(input).toBeInTheDocument();
expect(input).toHaveStyle('background: red');

await userEvent.click(input!);
expect(body?.querySelector('.ant-picker-time-panel')).not.toBeInTheDocument();
});

test('<DateField> - renders a input with correct id (inherited)', () => {
Expand Down

0 comments on commit 8e61732

Please sign in to comment.