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
feat: Add toHaveDisplayValue()
matcher
#223
feat: Add toHaveDisplayValue()
matcher
#223
Conversation
I've little experience with typescript, not sure if I should do something about type definitions 🤔 |
Codecov Report
@@ Coverage Diff @@
## master #223 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 20 +1
Lines 257 268 +11
Branches 62 65 +3
=========================================
+ Hits 257 268 +11
Continue to review full report at Codecov.
|
.toHaveDisplay()
custom matchertoHaveDisplayValue()
matcher
This looks like it only supports
|
Hi, @alexkrolick I think it's a good idea, it could be a twin matcher with But I was wondering if do the extra work in another PR instead of adding more changes to this one 🤔 |
@cloud-walker I'd rather have it all at once, even if it takes longer. The reason being that the PR merge triggers a new release, and I'd rather have this feature released in its entirety. This does not imply any pressure. Take your time, the same time you would've take to make the other PR. Good work here overall, and thanks! Also thanks to @eps1lon for stepping in and reviewing. |
Co-Authored-By: Toni Villena <tonivj5@Gmail.com>
Ok, input and textarea support added, I've excluded type=radio and type=checkbox, as they don't have a display value 🤔 |
Hi all, any news from this PR? 👀 |
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.
Looks good, thanks!
I left some comments of things still needed to be addressed. Let me know what you think about these.
expect(queryByTestId('select')).toHaveDisplayValue('Select a fruit...') | ||
expect(queryByTestId('select')).not.toHaveDisplayValue('Banana') |
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.
Would be nice if the test also covered the case of changing the selected option programmatically to banana
and then check that toHaveDisplayValue('Banana')
pass.
And maybe do it for the other cases as well (textarea and input).
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.
Done, I'm wondering why the repository is not using fireEvent
from the testing-library core (or even userEvent) 🤔
Co-Authored-By: Ernesto García <gnapse@gmail.com>
Co-Authored-By: Ernesto García <gnapse@gmail.com>
Co-Authored-By: Ernesto García <gnapse@gmail.com>
@all-contributors add @cloud-walker for code, test, ideas |
I've put up a pull request to add @cloud-walker! 🎉 |
🎉 This PR is included in version 5.5.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
Add
.toHaveDisplayValue()
custom matcher as discussed here: #221Checklist: