Permalink
Browse files

Sentence cases attribute name if no label is found when using label f…

…ormatter
  • Loading branch information...
1 parent f85c6fe commit be35469b3dd546c16b963d63b10f4d0191f88146 @thedersen committed Jul 19, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 backbone.validation.js
  2. +2 −2 tests/labelFormatter.js
View
@@ -376,7 +376,7 @@
// }
// });
label: function(attrName, model) {
- return model.labels[attrName] || attrName;
+ return model.labels[attrName] || defaultLabelFormatters.sentenceCase(attrName, model);
}
};
View
@@ -50,8 +50,8 @@ buster.testCase('Label formatters', {
assert.equals('Custom label is required', this.model.preValidate('someAttribute', ''));
},
- "returns attribute name when label is not found": function(){
- assert.equals('some_attribute is required', this.model.preValidate('some_attribute', ''));
+ "returns sentence cased name when label is not found": function(){
+ assert.equals('Some attribute is required', this.model.preValidate('some_attribute', ''));
}
},

0 comments on commit be35469

Please sign in to comment.