Skip to content

Conversation

@kevinrawal
Copy link
Contributor

@kevinrawal kevinrawal commented Aug 15, 2024

Issue Description

Problem
UncontrolledAccordion has a prop defaultOpen which allows the user to set some accordion item to open by default, The current logic of UncontrolledAccordion inherits the Accordion component's logic, We are initializing the open prop of Accordion component using the defaultOpen prop, There will be a case where user don't pass any value for the defaultOpen as they don't want any default opens. This will work properly but the test cases for a component that uses the UncontrolledAccordion will fail because if we don't pass any value for defaultOpen, It sets open prop to undefined, and test fails as open is marked as required and we are passing it's value undefined.

Fix
While initializing the open, we set its value to empty string instead of undefined, this will resolve the issue.

  • Bug fix
  • New feature
  • Chore
  • Breaking change
  • There is an open issue which this change addresses
  • I have read the CONTRIBUTING document.
  • My commits follow the Git Commit Guidelines
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • My change requires a change to Typescript typings.
    • I have updated the typings accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This PR is related to #2814, The same issue was resolved in the previous PR but a minor change is required in uncontrolled accordion.

uncontrolled accordion inherit properties of accordion component
open prop is required in accordion and if we do not pass defaultOpenprop
it initialize open to undefined which leads showing error/warning while
testing the component in jest which uses the uncontrolled accordion
@kevinrawal kevinrawal marked this pull request as ready for review August 15, 2024 14:23
@kevinrawal
Copy link
Contributor Author

@illiteratewriter can you please review this PR, Fixed the minor issue related to uncontrolled accordion which is similar to my previous commit #2814. This changes insure proper functionality of UncontrolledAccordion.

@kevinrawal kevinrawal changed the title fix: change default open state to empty string fix: change default open state to empty string for UncontrolledAccordion Aug 19, 2024
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.

1 participant