-
Notifications
You must be signed in to change notification settings - Fork 410
fix: recognize changed value of select #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: recognize changed value of select #126
Conversation
|
Thank you for your contribution 💃 |
| return items.map(mapper).join('') | ||
| } | ||
|
|
||
| /* eslint max-lines-per-function:0 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering why this is added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter was throwing this error on line 108 due to the length of tests for toHaveFormValues():
I noticed that this test file handled this problem this way, so I did the same. Let me know if another solution is preferred here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah alright, seems fair. Guess, we could split it up. I think @kentcdodds wrote an article about avoiding nesting: https://kentcdodds.com/blog/avoid-nesting-when-youre-testing
| return items.map(mapper).join('') | ||
| } | ||
|
|
||
| /* eslint max-lines-per-function:0 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah alright, seems fair. Guess, we could split it up. I think @kentcdodds wrote an article about avoiding nesting: https://kentcdodds.com/blog/avoid-nesting-when-youre-testing
|
🎉 This PR is included in version 4.0.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |

What:
Fixes #117, adds a test for this use case, and adds me as a contributor.
Why:
The
getSelectValue()util was usingselectedOptionsto get the selected options for aselect. BecauseselectedOptionsis not a reactive property, this was causing a bug wheretoHaveFormValues()would not recognize changedselectvalues.How:
This PR updates
getSelectValue()to useoptionsrather thanselectedOptions, then filter for the selected options, similar to the way this was fixed in dom-testing-library (as suggested in the issue).Checklist: