Skip to content
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(comp:input-number): Strictly check whether value is a number #1250

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

imguolao
Copy link
Contributor

@imguolao imguolao commented Nov 2, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

The value passed in from calling formGroup.setValue is not strictly checked.

What is the new behavior?

Strictly check if value is a number when calling formControl.setValue function.

// value is empty(not a number, but can be covert to number), 
// don't throw any error, set the value to null.
formControl.setValue({ value: '' })

// value is not a number(NaN), throw the error when environment is 'development',
// and set the value to null.
formControl.setValue({ value: {} })

// value is a string, not empty and can be covert to number,
// so set the value to the converted number.
formControl.setValue({ value: '123' })

// value is a string, not empty and can't be covert to number,
// so set the value to null and throw the error when environment is 'development'.
formControl.setValue({ value: '123a' })

Other information

@idux-bot
Copy link

idux-bot bot commented Nov 2, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Merging #1250 (110c705) into main (a05d7b7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 110c705 differs from pull request most recent head f235877. Consider uploading reports for the commit f235877 to get more accurate results

@@           Coverage Diff           @@
##             main    #1250   +/-   ##
=======================================
  Coverage   93.05%   93.05%           
=======================================
  Files         320      320           
  Lines       29433    29440    +7     
  Branches     3339     3339           
=======================================
+ Hits        27388    27395    +7     
  Misses       2045     2045           
Impacted Files Coverage Δ
packages/components/date-picker/src/types.ts 100.00% <100.00%> (ø)
...ages/components/input-number/src/useInputNumber.ts 80.08% <100.00%> (+0.25%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@danranVm danranVm merged commit 75c9fe1 into IDuxFE:main Nov 3, 2022
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.

None yet

2 participants