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

Conversation

Projects
None yet
3 participants
@dimaf
Contributor

dimaf commented Nov 7, 2012

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

@dispatchrabbi

This comment has been minimized.

Show comment
Hide comment
@dispatchrabbi

dispatchrabbi Nov 13, 2012

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.

Contributor

dispatchrabbi commented Nov 13, 2012

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 != '')

This comment has been minimized.

@daffl

daffl Nov 14, 2012

Contributor

I think it should do deep equality for everything then:

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

@daffl

daffl Nov 14, 2012

Contributor

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

Merge pull request #145 from dimaf/master
test&fix: null values crashing validations

@daffl daffl merged commit 579048b into canjs:master Jan 10, 2013

1 check passed

default The Travis build passed
Details

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