Skip to content

Commit

Permalink
changed props
Browse files Browse the repository at this point in the history
  • Loading branch information
zaxovaiko committed Feb 29, 2024
1 parent f232d6b commit afb8bc0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/uniforms/__suites__/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ export function testSelectField(SelectField: ComponentType<any>) {
test('<SelectField> - renders a select which correctly reacts on change (uncheck) by value', () => {
const onChange = jest.fn();
renderWithZod({
element: <SelectField name="x" onChange={onChange} />,
element: <SelectField fieldType={Array} name="x" onChange={onChange} />,
schema: z.object({ x: z.enum(['a', 'b']) }),
});
const select = screen.getByRole('combobox');
const select = screen.getByRole('listbox');
fireEvent.change(select, { target: { value: '' } });
expect(onChange).toHaveBeenCalledWith(undefined);
expect(onChange).toHaveBeenCalledWith([]);
});

test('<SelectField> - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => {
const onChange = jest.fn();
renderWithZod({
element: <SelectField name="x" onChange={onChange} />,
element: <SelectField fieldType={Array} name="x" onChange={onChange} />,
schema: z.object({ x: z.enum(['a', 'b']) }),
});
const select = screen.getByRole('combobox');
const select = screen.getByRole('listbox');
fireEvent.change(select, { target: { selectedIndex: -1 } });
expect(onChange).toHaveBeenCalledWith(undefined);
expect(onChange).toHaveBeenCalledWith([]);
});

// FIXME: This test is not working as expected
Expand Down

0 comments on commit afb8bc0

Please sign in to comment.