Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Commit

Permalink
refactor(core): renamed all validators to use lowerCamelCase
Browse files Browse the repository at this point in the history
see #21
  • Loading branch information
philippd committed Apr 22, 2014
1 parent 7aa7a91 commit 1589ea1
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions demo/core/custom-validator.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h3>constraints</h3>

demoApp.factory('customValidator', function () {
return {
name: 'CustomValidator',
name: 'customValidator',
validate: function (value) {
return value === 'Hanueli';
}
Expand All @@ -63,12 +63,12 @@ <h3>constraints</h3>
valdrProvider.addConstraints({
'Person': {
'lastName': {
'Required': {
'required': {
'message': 'This field is required.'
}
},
'firstName': {
'CustomValidator': {
'customValidator': {
'message': 'First name must be Hanueli.'
}
}
Expand Down
6 changes: 3 additions & 3 deletions demo/core/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h3>constraints</h3>
valdrProvider.addConstraints({
'Person': {
'firstName': {
'Size': {
'size': {
'min': 2,
'max': 20,
'message': 'First name must be between 2 and 20 characters.'
Expand All @@ -91,12 +91,12 @@ <h3>constraints</h3>
},
'Address': {
'email': {
'Email': {
'email': {
'message': 'Must be a valid E-Mail address.'
}
},
'zipCode': {
'Size': {
'size': {
'min': '4',
'max': '6',
'message': 'Zip code must be between 4 and 6 characters.'
Expand Down
16 changes: 8 additions & 8 deletions demo/core/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,33 +99,33 @@ <h3>constraints</h3>
valdrProvider.addConstraints({
'Person': {
'lastName': {
'Size': {
'size': {
'min': 2,
'max': 10,
'message': 'Last name must be between 2 and 10 characters.'
},
'Required': {
'required': {
'message': 'Last name is required.'
}
},
'firstName': {
'Size': {
'size': {
'min': 2,
'max': 20,
'message': 'First name must be between 2 and 20 characters.'
}
},
'age': {
'Min': {
'min': {
value: '21',
message: 'Must be 21 years old.'
},
'Required': {
'required': {
message: 'Age is required.'
}
},
'gender': {
'Required': {
'required': {
message: 'Gender is required.'
}
}
Expand All @@ -146,12 +146,12 @@ <h3>constraints</h3>
valdr.addConstraints({
'Address': {
'email': {
'Email': {
'email': {
'message': 'Must be a valid E-Mail address.'
}
},
'zipCode': {
'Pattern': {
'pattern': {
'value': /^\d{4}$/,
'message': 'Zip code must be 4 digits.'
}
Expand Down
6 changes: 3 additions & 3 deletions demo/demoConstraints.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"Person": {
"lastName": {
"Size": {
"size": {
"min": 2,
"max": 10,
"message": "javax.validation.constraints.Size.message"
}
},
"firstName": {
"Size": {
"size": {
"min": 2,
"max": 20,
"message": "javax.validation.constraints.Size.message"
}
},
"zipCode": {
"Size": {
"size": {
"min": 4,
"max": 4,
"message": "javax.validation.constraints.Size.message"
Expand Down
6 changes: 3 additions & 3 deletions demo/message/angular-translate.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ <h3>constraints</h3>
valdrProvider.addConstraints({
'Person': {
'lastName': {
'Required': {
'required': {
'message': 'message.required'
},
'Size': {
'size': {
'min': 5,
'max': 20,
'message': 'message.size'
}
},
'firstName': {
'Size': {
'size': {
'min': 3,
'max': 10,
'message': 'message.size'
Expand Down
8 changes: 4 additions & 4 deletions demo/message/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h3>constraints</h3>
valdrProvider.addConstraints({
'Person': {
'lastName': {
'Required': {
'required': {
'message': 'Last name is required.'
},
'Size': {
Expand All @@ -104,20 +104,20 @@ <h3>constraints</h3>
}
},
'firstName': {
'Size': {
'size': {
'min': 2,
'max': 20,
'message': 'First name must be between 2 and 20 characters.'
}
},
'age': {
'Min': {
'min': {
value: '21',
message: 'Person must be 21 years old.'
}
},
'gender': {
'Required': {
'required': {
'message': 'Gender is required.'
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/core/valdr-service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('valdr', function () {
personConstraints = {
'Person': {
'firstName': {
'Size': {
'size': {
'min': 0,
'max': 10,
'message': 'size'
Expand All @@ -15,7 +15,7 @@ describe('valdr', function () {
addressConstraints = {
'Address': {
'street': {
'Required': {
'required': {
'message': 'required'
}
}
Expand Down Expand Up @@ -123,12 +123,12 @@ describe('valdr', function () {
valdr.addConstraints({
'Person': {
'firstName': {
'Size': {
'size': {
'min': 2,
'max': 10,
'message': 'size'
},
'Required': {
'required': {
'message': 'required'
}
}
Expand Down Expand Up @@ -210,14 +210,14 @@ describe('valdrProvider', function () {
valdrProvider.addConstraints({
'Person': {
'firstName': {
'SizeBetween': {
'sizeBetween': {
'min': 0,
'max': 10
}
}
}
});
valdrProvider.addConstraintAlias('Size', 'SizeBetween');
valdrProvider.addConstraintAlias('size', 'sizeBetween');
});


Expand All @@ -242,7 +242,7 @@ describe('valdrProvider', function () {
module(function ($provide){
$provide.factory('customValidator', function () {
return {
name: 'Custom',
name: 'custom',
validate: function (value) {
return value === 'Hanueli';
}
Expand All @@ -255,7 +255,7 @@ describe('valdrProvider', function () {
valdrProvider.addConstraints({
'Person': {
'firstName': {
'Custom': {}
'custom': {}
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/digitsValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ angular.module('valdr')
};

return {
name: 'Digits',
name: 'digits',

/**
* Checks if the value is a number within accepted range.
Expand Down
4 changes: 2 additions & 2 deletions src/core/validators/digitsValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ describe('digitsValidator', function () {
constraint = { integer: '4', fraction: '2' };
}));

it('should be named "Digits"', function () {
expect(digitsValidator.name).toBe('Digits');
it('should be named "digits"', function () {
expect(digitsValidator.name).toBe('digits');
});

it('should return true for empty, null, and undefined', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/emailValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ angular.module('valdr')
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;

return {
name: 'Email',
name: 'email',

/**
* Checks if the value is a valid email address.
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/emailValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('emailValidator', function () {
}));

it('should provide the correct name', function () {
expect(emailValidator.name).toBe('Email');
expect(emailValidator.name).toBe('email');
});

it('should return true for empty values', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/futureValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ angular.module('valdr')
.factory('futureValidator', ['futureAndPastSharedValidator', function (futureAndPastSharedValidator) {

return {
name: 'Future',
name: 'future',

/**
* Checks if the value is a date in the future.
Expand Down
4 changes: 2 additions & 2 deletions src/core/validators/futureValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ describe('futureValidator', function () {
futureValidator = _futureValidator_;
}));

it('should be named "Future"', function () {
expect(futureValidator.name).toBe('Future');
it('should be named "future"', function () {
expect(futureValidator.name).toBe('future');
});

it('should return true for empty values', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/maxValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ angular.module('valdr')
.factory('maxValidator', ['valdrUtil', function (valdrUtil) {

return {
name: 'Max',
name: 'max',

/**
* Checks if the value is a number and lower or equal as the value specified in the constraint.
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/maxValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('maxValidator', function () {
}));

it('should provide the correct name', function () {
expect(maxValidator.name).toBe('Max');
expect(maxValidator.name).toBe('max');
});

it('should return true for empty values', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/minValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ angular.module('valdr')
.factory('minValidator', ['valdrUtil', function (valdrUtil) {

return {
name: 'Min',
name: 'min',

/**
* Checks if the value is a number and higher or equal as the value specified in the constraint.
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/minValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('minValidator', function () {
}));

it('should provide the correct name', function () {
expect(minValidator.name).toBe('Min');
expect(minValidator.name).toBe('min');
});

it('should return true for empty values', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/pastValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ angular.module('valdr')
.factory('pastValidator', ['futureAndPastSharedValidator', function (futureAndPastSharedValidator) {

return {
name: 'Past',
name: 'past',

/**
* Checks if the value is a date in the past.
Expand Down
4 changes: 2 additions & 2 deletions src/core/validators/pastValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ describe('pastValidator', function () {
pastValidator = _pastValidator_;
}));

it('should be named "Past"', function () {
expect(pastValidator.name).toBe('Past');
it('should be named "past"', function () {
expect(pastValidator.name).toBe('past');
});

it('should return true for empty values', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/patternValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ angular.module('valdr')
};

return {
name: 'Pattern',
name: 'pattern',

/**
* Checks if the value matches the pattern defined in the constraint.
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/patternValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('patternValidator', function () {
}));

it('should provide the correct name', function () {
expect(patternValidator.name).toBe('Pattern');
expect(patternValidator.name).toBe('pattern');
});

it('should return true for empty values', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/requiredValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ angular.module('valdr')

.factory('requiredValidator', ['valdrUtil', function (valdrUtil) {
return {
name: 'Required',
name: 'required',

/**
* Checks if the value is not empty.
Expand Down
2 changes: 1 addition & 1 deletion src/core/validators/requiredValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('requiredValidator', function () {
}));

it('should provide the correct name', function () {
expect(requiredValidator.name).toBe('Required');
expect(requiredValidator.name).toBe('required');
});

it('should validate using the valdrUtil', function () {
Expand Down
Loading

0 comments on commit 1589ea1

Please sign in to comment.