adopted-ember-addons / ember-validators

A collection of EmberJS validators
Other
24 stars 40 forks source link

[Bug] The inclusion validator validates "NaN" as a valid number... #106

Open frykten opened 2 years ago

frykten commented 2 years ago

Hi!

I'm pretty sure this was not meant to be as it wasn't tested as an accepted value:

The issue is pretty simple when reading the code: https://github.com/offirgolan/ember-validators/blob/1568f472eb5d9851222b9944521ff1ba529641dd/addon/inclusion.js#L42

When checking their type, NaN and any number will return true as they are all numbers. And NaN is neither superior nor inferior to any number---since it has no value... So it will never return the validationError...

I'll file a PR for that, and I'll add a check to the tests suite.