-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add comprehensive tests for Canvas width and height props #3553
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
Add comprehensive tests for Canvas width and height props #3553
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 061c2a3:
|
Co-authored-by: abernier <[email protected]>
abernier
left a comment
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.
see comments
Removed hard-coded dimension values by exporting them from the react-use-measure mock and importing them in the tests. This ensures the test values always match the actual mock implementation. (f9ff27c) |
5231113 to
061c2a3
Compare
abernier
left a comment
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.
lgtm
This PR adds comprehensive test coverage for the new
widthandheightprops added to theCanvascomponent, ensuring proper sizing behavior and backward compatibility.What was tested
The tests verify that the Canvas component correctly handles manual sizing through the new props:
widthandheightprops are provided, the canvas element uses those exact dimensionsuseMeasureuseMeasurelogic continues to work as beforeTest cases added
Implementation details
@testing-library/reactsetup and patternscanvas?.getAttribute('width')react-use-measuremock that returns fixed 1280x800 dimensionscanvas.test.tsxfileThis ensures that the new manual sizing feature works correctly while preserving the existing responsive behavior when manual dimensions are not provided.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.