-
Notifications
You must be signed in to change notification settings - Fork 621
Migrate PointerBox tests from Jest to Vitest #6407
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
base: main
Are you sure you want to change the base?
Conversation
|
Co-authored-by: joshblack <[email protected]>
Co-authored-by: joshblack <[email protected]>
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.
@copilot make sure to also pull in the latest changes from main
and address merge conflicts
}) | ||
|
||
it('applies the border color via "borderColor" prop for backwards compatibility', () => { | ||
expect(render(<PointerBox borderColor="danger.emphasis" />)).toMatchSnapshot() | ||
expect(render(<PointerBox borderColor="danger.emphasis" theme={theme} />)).toMatchSnapshot() |
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.
Update this test from a snapshot test to one that is checking that the border color is set correctly
}) | ||
|
||
it('applies the border color via sx prop', () => { | ||
expect(render(<PointerBox sx={{borderColor: 'danger.emphasis'}} />)).toMatchSnapshot() | ||
expect(render(<PointerBox sx={{borderColor: 'danger.emphasis'}} theme={theme} />)).toMatchSnapshot() |
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.
Update this test from a snapshot test to one that is checking that the border color is set correctly
const {container} = HTMLRender(<PointerBox />) | ||
const results = await axe.run(container) | ||
expect(results).toHaveNoViolations() | ||
expect(render(<PointerBox theme={theme} />)).toMatchSnapshot() |
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.
Remove this test
<PointerBox bg="danger.emphasis" /> | ||
</ThemeProvider>, | ||
), | ||
).toMatchSnapshot() |
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.
Update this test from a snapshot test to one that is checking the background color
}) | ||
|
||
it('applies the background color via sx prop', () => { | ||
expect(render(<PointerBox sx={{bg: 'danger.emphasis'}} />)).toMatchSnapshot() | ||
expect( |
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.
Update this test from a snapshot test to one that is checking the background color
This PR migrates the PointerBox component tests from Jest to Vitest as part of the broader test suite migration effort.
Changes Made
describe
,expect
,it
) and @testing-library/react (render
)behavesAsComponent
usage (component behavior tests)checkExports
usage (module export validation)toHaveNoViolations
(accessibility testing)ThemeProvider
wrapper for tests that require styled-components theme context, particularly for background color styling testsrenderStyles
function (which had Node.js dependencies incompatible with browser tests) with direct DOM manipulation usingwindow.getComputedStyle
Test Coverage
All 6 original tests have been successfully migrated and are passing:
borderColor
prop (backwards compatibility)sx
propbg
prop (backwards compatibility)sx
propbg
prop andsx
propThe migration maintains full test functionality while adapting to Vitest's browser-based testing environment.
Fixes #6390.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.