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

test&fix: null values crashing validations #145

Merged
merged 1 commit into from
Jan 10, 2013
Merged

Conversation

dimaf
Copy link
Contributor

@dimaf dimaf commented Nov 7, 2012

when null or undefined values are present in model then range, length, formatOf validations are not working correctly

@dispatchrabbi
Copy link
Contributor

This looks good at first glance, but I'll take another look after we do the 1.1 release to make sure it's exactly how we want our validators to handle this.

@@ -176,7 +176,7 @@ can.each([ can.Observe, can.Model ], function(clss){
*/
validateFormatOf: function(attrNames, regexp, options) {
validate.call(this, attrNames, options, function(value) {
if( (typeof value != 'undefined' && value != '')
if( (typeof value != 'undefined' && value !== null && value != '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should do deep equality for everything then:

if( (typeof value != ='undefined' && value !== null && value !== '')

daffl added a commit that referenced this pull request Jan 10, 2013
test&fix: null values crashing validations
@daffl daffl merged commit 579048b into canjs:master Jan 10, 2013
daffl added a commit that referenced this pull request Jan 10, 2013
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

3 participants