-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs][Rating] Added info about workaround for testing #44129
Conversation
Netlify deploy previewBundle size report |
|
||
Testing with `@testing-library/user-event` | ||
|
||
When using `@testing-library/user-event` for testing the `Rating` component, you may encounter an issue where `onChange` returns `NaN`. This happens because the mouse event simulations rely on `getBoundingClientRect`, which returns default values (zeros) in Jest. |
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.
When using `@testing-library/user-event` for testing the `Rating` component, you may encounter an issue where `onChange` returns `NaN`. This happens because the mouse event simulations rely on `getBoundingClientRect`, which returns default values (zeros) in Jest. | |
When using `@testing-library/user-event` for testing the `Rating` component, you may encounter an issue where `onChange` returns `NaN`. This happens because the mouse event simulations rely on `getBoundingClientRect`, which returns default values (zeros) in jsdom. |
@@ -12,6 +12,19 @@ githubSource: packages/mui-material/src/Rating | |||
<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> | |||
|
|||
{{"component": "@mui/docs/ComponentLinkHeader"}} | |||
:::warning |
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.
This isn't going to happen, not here at the top of the file 😄
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.
Sure thing. Where should i place it then ? At the bottom ? Could you suggest a place for it. Should i use a warning ?
Let me know i'll add suggested changes and move it around.
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.
@DiegoAndai How do you think we should proceed here considering this #38828 (comment)?
My suggestion is that developers should check the source code and we shouldn't document this. Adding a workaround to the docs risks becoming outdated as the implementation evolves. Developers encountering this issue should be encouraged to consult the source code for testing strategies, which is actively maintained and verified in CI.
I agree with #38828 (comment) and with @ZeeshanTamboli. Closing as not planned. @p-pych, thanks for contributing, and sorry that this PR didn't get merged. If you wish to continue to work on this issue, that would be great! Please read #38828 (comment) for next steps and let us know. |
Closes: 38828