Skip to content

Add tests for select#201

Merged
jannikbuschke merged 3 commits into
jannikbuschke:masterfrom
Kzoeps:tests-select
Nov 24, 2022
Merged

Add tests for select#201
jannikbuschke merged 3 commits into
jannikbuschke:masterfrom
Kzoeps:tests-select

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Nov 20, 2022

Copy link
Copy Markdown
Contributor
  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. Impossible to expand Select component dropdown programatically ant-design/ant-design#22074 (comment)
  2. Cannot test Select with react testing library after upgrading to v4 ant-design/ant-design#23009

@jannikbuschke jannikbuschke merged commit 4563e51 into jannikbuschke:master Nov 24, 2022
@jannikbuschke

Copy link
Copy Markdown
Owner

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

@allcontributors

Copy link
Copy Markdown
Contributor

@jannikbuschke

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

@Kzoeps Kzoeps deleted the tests-select branch November 24, 2022 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants