ui
ui copied to clipboard
Unclearable NaN value in NumberInput example
Steps to reproduce:
- Go to https://sveltekit.now.sh/#NumberInput
- Focus on the input element and clear the value by pressing Backspace button
Actual behavior: NaN value is displayed and can't be cleared/changed even with increase/decrease buttons (arrows).
Expected behavior: value is cleared.

It seems that's because isFinite('') is true:
https://github.com/sveltekit/ui/blob/41a6cd96f17eb98cedbafbaca97b8e50252f60a7/src/components/NumberInput/NumberInput.svelte#L25-L27
so it is casted to float: https://github.com/sveltekit/ui/blob/41a6cd96f17eb98cedbafbaca97b8e50252f60a7/src/components/NumberInput/NumberInput.svelte#L33-L35
Actually, unit tests could help to catch this issue. I personally know about Svelte Testing Library, maybe there is something else.