feat: added differentiation between indian numeral system and international numeral system in currency input widget #28862
Issue Link
Description:
I have raised this PR to Add the
Added Differentiation between Indian numeral system and International numeral system in currency input widget
The Currency Input widget currently formats numbers in a generic manner, without differentiating between the Indian numeral system and the International numeral system. This can lead to confusion and errors, particularly for users accustomed to a specific formatting style.
Cypress video
https://github.com/user-attachments/assets/5a48fc65-7c2c-40d7-9270-33b793923ec5
Screenshots:
Before resolving bug:
After resolving bug:
Summary by CodeRabbit
-
New Features
- Enhanced Currency Input Widget with improved currency formatting based on country code.
- Added an end-to-end test suite for the Currency Input Widget to ensure proper numeral system differentiation.
-
Bug Fixes
- Fixed validation logic in KeyValueComponent to ensure consistent error messaging for empty fields.
-
Documentation
- Updated test coverage to include country-specific formatting for currency inputs.
-
Chores
- Enhanced utility functions for locale-aware currency formatting.
Walkthrough
The recent updates improve the Currency Input Widget and related components by adding country-specific currency formatting and enhancing input validation. A new test suite is introduced to ensure the widget handles different numeral systems correctly. Additionally, the utility functions now support locale-aware formatting, making the system more adaptable to various regional requirements and enhancing overall user experience.
Changes
| Files | Change Summary |
|---|---|
app/client/cypress/e2e/Regression/.../CurrencyInput_spec4.js |
Added an end-to-end test suite for the Currency Input Widget, validating its handling of different numeral systems and currency types. |
app/client/src/widgets/CurrencyInputWidget/component/utilities.ts |
Introduced a new getLocaleString function and modified formatCurrencyNumber to accept a countryCode, enhancing locale-aware currency formatting. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant CurrencyInputWidget
participant Utilities
User->>CurrencyInputWidget: Input value
CurrencyInputWidget->>Utilities: formatCurrencyNumber(value, countryCode)
Utilities->>Utilities: getLocaleString(countryCode)
Utilities-->>CurrencyInputWidget: Return formatted value
CurrencyInputWidget-->>User: Display formatted currency
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@PrasadMadine We have seen there is change in src with business logic. This logic can be tested with Jest unit tests or React testing library. Cypress is redundant here. Let me know reason behind cypress case writing.
Hello @sagar-qa007 , Will update the PR with unit test cases. I have written cypress test to visually check the functionality is working as expected.
Hello @sagar-qa007 , Updated the test cases, could you please review this PR
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.
Hi @sagar-qa007 @ApekshaBhosale , Could you please review this PR when you have sometime. Thankyou
Hello @sagar-qa007 @znamenskii-ilia , Could you please review this PR, I have updated it.
@rahulbarwal Please create shadow PR as changes looks fine.
Any changes in the older layout or widget need to be approved by the current Widgets team. @sagar-qa007 kindly ensure that it always happens.
@rahulbarwal this seems more related to your POD, kindly check. Ilia has done it on Anvil teams behalf.
QQ @znamenskii-ilia, Why is Anvil team getting tagged on this widget, isint this from the fixed layout?
Hello @rahulbarwal , Could you please review this PR.
Hello @rahulbarwal , Please review this PR..
hey @PrasadMadine, I'll prioritise this soon. Thanks for your effort here.
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.
This PR has been closed because of inactivity.