Fix: shouldShowNumberKeyboard logic #611
Merged
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.
What is the purpose of this pull request?
Fix the behavior implemented here: #610
And add tests to guarantee that all the cases are covered so the function shouldShowNumberKeyboard:
✓ Should return true for mask rule undefined (1 ms)
✓ Should return true for mask rule null
✓ Should return true for mask rule empty string
✓ Should return true for mask rule numeric string without separators (1 ms)
✓ Should return true for mask rule numeric string with spaces
✓ Should return true for mask rule numeric string with dashes
✓ Should return false for mask rulee for string with letters
✓ Should return false for mask rulee for string with mixed letters and spaces
✓ Should return false for mask rulee for mixed numeric and letter string with dashes (1 ms)
✓ Should return false for mask rulee for NaN
What problem is this solving?
This validation is not correct implemented:
https://github.com/vtex/address-form/pull/610/files#diff-ba3efeb1ca67806eaaa1c0260a917dec21401eb72f01f9311243c42e73c57717R95
How should this be manually tested?
You can run yarn test and use this workspace for validation:
https://debug--dunnesstoresqa.myvtex.com/account#/addresses/new
Types of changes