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

Fix duplicate user props #2256

Merged
merged 3 commits into from
May 25, 2022
Merged

Fix duplicate user props #2256

merged 3 commits into from
May 25, 2022

Conversation

becca-bailey
Copy link
Contributor

This fixes a bug that Paul and I were running into where the user props like data-testid and aria-label were being passed in to both the container and the group component, so even when we were rendering a victory data component as a standalone component (without a container or VictoryChart wrapper), screen.getByTestId was returning multiple nodes in the tests rather than the parent wrapper component.

In order to fix this, I removed the user props logic from the renderData function in add-events, and passed the user props into the root component that was returned from a Victory component rather than the container. This ensures that the props will be passed into either the svg or the g component, depending on whether there is another container present. I also added some additional test coverage around this, which we should add to other component tests as we convert them.

@heythisispaul
Copy link
Contributor

Other than maybe deleting that unneeded test util, this looks good to me!

Copy link
Member

@scottrippey scottrippey left a comment

Choose a reason for hiding this comment

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

Great changes, glad to see an easy way to add these userProps.
Minor changes requested for using jest-dom, otherwise good!

Becca Bailey added 3 commits May 25, 2022 12:46
This moves the user props logic from the container component to the
top-level returned component, whether that is a container or a group
component. This allows the safe props to work in a standlone component,
or a component that is a child of another victory container or
VictoryChart component.
@becca-bailey becca-bailey force-pushed the bug/fix-duplicate-user-props branch from fa40657 to 460ac09 Compare May 25, 2022 19:47
@becca-bailey becca-bailey merged commit f1d9e70 into main May 25, 2022
@becca-bailey becca-bailey deleted the bug/fix-duplicate-user-props branch May 25, 2022 20:15
@becca-bailey
Copy link
Contributor Author

@heythisispaul you should be able to merge this into your PR now.

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.

3 participants