jannikbuschke / formik-antd

Simple declarative bindings for Ant Design and Formik.
https://codesandbox.io/s/github/jannikbuschke/formik-antd-example
MIT License
587 stars 81 forks source link

Add tests for select #201

Closed Kzoeps closed 1 year ago

Kzoeps commented 1 year ago
  1. Created a test to check if select is rendered
  2. Created a test to see if the initial value is set on render. Did this using a check to see if the selected value is initially present or not. Couldn't use value since antd renders Select as input with combobox and doesn't update the value
  3. Created a test to see if the value changes when the user clicks on a different option. Since fireEvent.change does not seem to work, I used mouseDown to first open the select and then click to select an option. antd renders the options as span so I was not able to use option.selected. Furthermore I used the check of toBeGreaterThan since I couldnt find a way to close the dropdown.

@jannikbuschke lmk what if you have any feedback or changes to be made

Referenced these links while coming up with the third test:

  1. https://github.com/ant-design/ant-design/issues/22074#issuecomment-597061052
  2. https://github.com/ant-design/ant-design/issues/23009
jannikbuschke commented 1 year ago

looks cool 👍 @all-contributors add @Kzoeps for test

allcontributors[bot] commented 1 year ago

@jannikbuschke

I've put up a pull request to add @Kzoeps! :tada: