-
Notifications
You must be signed in to change notification settings - Fork 13
Resolution of issues #468 and possibly #483 #551
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
base: main
Are you sure you want to change the base?
Resolution of issues #468 and possibly #483 #551
Conversation
|
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.
Looking good, thanks @ErvinSabic! But we would need some test for this. @averydev had one already here, linked in #468.
Also just merged #550, so if you could rebase this should give us a green build (ignoring the known docs deployment issue)
packages/ember-headless-form/src/-private/components/control/input.gts
Outdated
Show resolved
Hide resolved
packages/ember-headless-form/src/-private/components/control/input.gts
Outdated
Show resolved
Hide resolved
} | ||
// This is here to avoid setting the value as NaN, instead using Zero. | ||
else if(e.target.value === "" || isNaN(valueAsNumber)){ | ||
this.args.setValue(0); |
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.
I am not quite sure about this one. Can you explain your rationale for this case?
Wouldn't not setting the value here be more appropriate?
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.
Here's a video explaining my thinking -
zerodefault.mp4
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.
Defaulting to a zero is simpler than maintaining the last valid state like I do on my intl number input. Number inputs should always be numbers.
add test for issue with entering numbers with a decimal
…aned input component
I just went ahead and pulled the latest from the base branch, added a variation of the test you'd given along with an extra. Should test and merge in green now. |
Something seems to be going on with prettier in the linting process? |
Used some of @simonihmig 's suggestions along with accounted for NaN or blank values defaulting to zero.