-
Notifications
You must be signed in to change notification settings - Fork 77
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(input, input-number): no longer removes trailing decimal separator #7159
Merged
anveshmekala
merged 29 commits into
master
from
anveshmekala/7039-fix-calcite-input-decimal-separator
Jun 29, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
59b5a85
fix(input): no longer remove trailing decimal separator
anveshmekala 4613212
add localized leading decimal zero values
anveshmekala f241c17
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala 387db5b
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala 54b7143
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala 5d6f507
fix tests
anveshmekala c6a1e71
fix tests
anveshmekala cffe278
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala 1c60d07
cleanup
anveshmekala eacde2d
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala c447239
refactor
anveshmekala 7a0480a
refactor util method
anveshmekala 87f15d7
remove redundant code blocks
anveshmekala 63dff04
refactor util method to handle comma decimal separator
anveshmekala d06003b
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala 6751aaa
refactor util methods
anveshmekala 688b98a
update tests
anveshmekala f7b9f94
remove commented code
anveshmekala 43b3075
add missing type for tests
anveshmekala cd4a3ac
fix failing spec tests
anveshmekala 98c86d4
use regex
anveshmekala ce04bab
add more spec tests
anveshmekala ecbc697
remove unused imports
anveshmekala fbc3831
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala de31f7c
simplify util method logic
anveshmekala 05b771c
Merge branch 'master' into anveshmekala/7039-fix-calcite-input-decima…
anveshmekala c507400
feedback changes and more e2e tests added
anveshmekala 4a57130
remove unused methods in number spec test
anveshmekala dfc9311
add new lines in test
anveshmekala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the component's value should still be
1
. You will need to go into the shadowRoot and check the value of the internal input to verify it is1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind that is what you were doing it was other input tests failing. I need read closer before opening my big mouth lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem. The issues with other tests is the immutation of
localizedValue
when the user tries to delete the decimal part. The logic applies even if the user is typing out a value like0.05
. By the time user types0.0
the validation is happening hence changing the localizedValue to0
again. Current logic in default branch avoids this by not changing thelocalizedValue
variable until the user inputs a valid value which allows users to type the value of their without any auto correction.Trying to figure out a reliable way to identify if the user is adding a value in the input field or deleting the value so that we can apply the logic only for deletion case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.
Some potential options for investigation:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i was using the second option which is not feasible with
inputEvent
. i had to create a combination of above. Realized there was an another bug with the input when the user has leading0
's in the decimal. If the user deletes the2
in0.00002
then the value becomes0
which is similar to #7039 . I tried adding those trailing zero's back in the decimal but the localize method is removing them too. We may have to follow similar technique of adding back those zeros like we did for decimal separator.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or we can refactor this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the input lifecycle methods will probably need a refactor. Once you start doing crazy stuff like this to fix bugs you know you've gone too far lol.