Skip to content

fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is negative#10913

Merged
pmakode-akamai merged 3 commits intolinode:developfrom
pmakode-akamai:M3-8553-fix-displayprice-story-crash-when-digits-prop-in-currency-component-is-neg
Sep 11, 2024
Merged

fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is negative#10913
pmakode-akamai merged 3 commits intolinode:developfrom
pmakode-akamai:M3-8553-fix-displayprice-story-crash-when-digits-prop-in-currency-component-is-neg

Conversation

@pmakode-akamai
Copy link
Contributor

@pmakode-akamai pmakode-akamai commented Sep 10, 2024

Description 📝

The Storybook for DisplayPrice is crashing when the minimumFractionDigits in the Currency component is set with a negative value.

This PR addresses the issue by updating the Currency component to handle negative decimalPlaces props correctly. Specifically, it ensures that the minimumFractionDigits defaults to 2 when the decimalPlaces prop is negative or undefined.

Changes 🔄

  • Handle negative decimalPlaces prop in Currency component to fix DisplayPrice story
    • The minimumFractionDigits in the Currency component will now use the default value (2) when decimalPlaces prop is negative or undefined.
  • Add a unit test case to cover the above scenario.
  • Update all other unit test cases for more clarity.

Target release date 🗓️

N/A

How to test 🧪

Reproduction steps

  • Go to the DisplayPrice storybook
  • Enter a negative value for decimalPlaces prop

Verification steps

  • Run storybook locally and verify that the Story for DisplayPrice should not crash when the decimalPlaces prop is negative.
  • Confirm that the The minimumFractionDigits in the Currency component uses the default value (2) when decimalPlaces prop is negative or undefined.
  • Verify that all the unit test cases pass.

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@pmakode-akamai pmakode-akamai self-assigned this Sep 10, 2024
@pmakode-akamai pmakode-akamai requested a review from a team as a code owner September 10, 2024 07:59
@pmakode-akamai pmakode-akamai requested review from carrillo-erik, coliu-akamai and hana-akamai and removed request for a team September 10, 2024 07:59
@pmakode-akamai pmakode-akamai changed the title fix: [M3-8553] - DisplayPrice story crash when Currency Component's minimumFractionDigits is Negative fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is Negative Sep 10, 2024
@pmakode-akamai pmakode-akamai changed the title fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is Negative fix: [M3-8553] - DisplayPrice story crash when Currency component's minimumFractionDigits is negative Sep 10, 2024
@pmakode-akamai pmakode-akamai added the Bug Fixes for regressions or bugs label Sep 10, 2024
@github-actions
Copy link

github-actions bot commented Sep 10, 2024

Coverage Report:
Base Coverage: 86.4%
Current Coverage: 86.4%

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

looks great + thanks for adding additional test coverage! 🎉

@coliu-akamai coliu-akamai added the Add'tl Approval Needed Waiting on another approval! label Sep 10, 2024
@hana-akamai hana-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Sep 10, 2024
@pmakode-akamai pmakode-akamai merged commit 8d028f9 into linode:develop Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants