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(react): update radio button group state initialization #9104

Merged

Conversation

joshblack
Copy link
Contributor

Closes #9041

This updates how we initialize our selected state value from a || expression to a ternary that checks if the value is undefined. When using ||, the state would be incorrectly initialized if the value was false-y but not undefined (like the value 0).

I also took this small change to convert some of the tests for RadioButtonGroup to RTL. It also updates the jest-dom matchers to be brought in automatically.

Changelog

New

Changed

  • Update RadioButtonGroup.js to correctly initialize selected state
  • Update RadioButtonGroup-test.js file to start using RTL
  • Update jest-config-carbon to automatically bring in jest-dom matchers

Removed

Testing / Reviewing

@joshblack joshblack requested a review from a team as a code owner July 2, 2021 17:26
@joshblack joshblack requested review from tw15egan and dakahn July 2, 2021 17:26
@netlify
Copy link

netlify bot commented Jul 2, 2021

✔️ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: 509d435

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/60e5a684abfbb80008f1bba2

😎 Browse the preview: https://deploy-preview-9104--carbon-react-next.netlify.app

@netlify
Copy link

netlify bot commented Jul 2, 2021

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: 509d435

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/60e5a68559950b0007dda997

😎 Browse the preview: https://deploy-preview-9104--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Jul 2, 2021

✔️ Deploy Preview for carbon-components-react ready!
Built without sensitive environment variables

🔨 Explore the source changes: 509d435

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/60e5a6845e91240008c9f866

😎 Browse the preview: https://deploy-preview-9104--carbon-components-react.netlify.app

Copy link
Member

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

LGTM 👍 ✅

@kodiakhq kodiakhq bot merged commit 0e2b53b into carbon-design-system:main Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RadioButtonGroup mishandles the input falsy value as an undefined value
3 participants