Skip to content
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(react): support react 17 #1680

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft

Conversation

anastasialanz
Copy link
Contributor

@anastasialanz anastasialanz commented Sep 17, 2024

closes #1473

The Modal component works fine with the Cauldron 17 upgrade.

modal-component.mov

TODO:

@anastasialanz anastasialanz changed the title fix: react 17 upgrade feat: react 17 upgrade Sep 17, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1680.d15792l1n26ww3.amplifyapp.com

@@ -545,6 +548,9 @@ test('should not prevent default with enter keypress and closed listbox', () =>
// rtl doesn't let us mock preventDefault
// see: https://github.com/testing-library/react-testing-library/issues/572
event.preventDefault = preventDefault;
if (type === 'focus') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Jason:

The changes here I suspect are related to testing-library/user-event#592, but we're not using user-event but are calling fireEvent due to specific limitations with testing library.

@anastasialanz anastasialanz changed the title feat: react 17 upgrade feat(react): support react 17 Sep 18, 2024
@anastasialanz anastasialanz self-assigned this Sep 18, 2024
expect(outsideButton).toBeTruthy();
await user.click(outsideButton);
render(<Wrapper tooltipProps={{ onClose }} />);
await user.click(document.body);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to add any other elements to test clicking outside. We can click on the body element instead.

buttonProps = {},
tooltipProps = {}
}: {
interface PopoverProps {
Copy link
Contributor Author

@anastasialanz anastasialanz Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small cleanup since these types were repeated.

await waitFor(() => expect(handleClose).toHaveBeenCalledTimes(1));
});

test('close opened popover when clicking on the popover trigger button', async () => {
Copy link
Contributor Author

@anastasialanz anastasialanz Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test verifies that the popover content is not in the document once the popover button is clicked. It's failing so we know it's a bug. I originally went with the handleClose check but that passed since it's being called twice. This is closer to what a user sees to know that the content is not there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to React 17
2 participants