diff --git a/spec/validators/integer-validator-spec.js b/spec/validators/integer-validator-spec.js index b8c0a4d..c28a645 100644 --- a/spec/validators/integer-validator-spec.js +++ b/spec/validators/integer-validator-spec.js @@ -1,7 +1,7 @@ describe('ko.validators.integerValidator', function () { var validator; - beforeEach(function() { + beforeEach(function () { validator = ko.validators.integerValidator('Must be a number.'); }); diff --git a/spec/validators/invalid-chars-validator-spec.js b/spec/validators/invalid-chars-validator-spec.js index 2feac38..14d9f59 100644 --- a/spec/validators/invalid-chars-validator-spec.js +++ b/spec/validators/invalid-chars-validator-spec.js @@ -1,29 +1,29 @@ describe('ko.validators.invalidCharsValidator', function () { var validator; - beforeEach(function() { + beforeEach(function () { validator = ko.validators.invalidCharsValidator(['a', 'b'], "Must not contain 'a' nor 'b'."); }); - it('passes when the value does not contain invalid chars', function() { + it('passes when the value does not contain invalid chars', function () { expect(validator.validate('foo').isValid).toBe(true); }); - it('fails when the value does contain invalid chars', function() { + it('fails when the value does contain invalid chars', function () { expect(validator.validate('foao').isValid).toBe(false); }); - it('passes with an empty string', function() { + it('passes with an empty string', function () { expect(validator.validate('')).toEqual({ isValid: true }); }); - it('works with spaces', function() { + it('works with spaces', function () { validator = ko.validators.invalidCharsValidator([' ']); expect(validator.validate('fo o').isValid).toBe(false); expect(validator.validate('foo').isValid).toBe(true); }); - it('has correct message on failure', function() { + it('has correct message on failure', function () { expect(validator.validate('fooa')).toEqual({ isValid: false, message: "Must not contain 'a' nor 'b'." diff --git a/spec/validators/max-length-validator-spec.js b/spec/validators/max-length-validator-spec.js index a28388e..9c1c39b 100644 --- a/spec/validators/max-length-validator-spec.js +++ b/spec/validators/max-length-validator-spec.js @@ -1,26 +1,26 @@ -describe('ko.validators.maxLengthValidator', function() { +describe('ko.validators.maxLengthValidator', function () { var validator, result; - beforeEach(function() { + beforeEach(function () { validator = ko.validators.maxLengthValidator(5, 'Cannot be longer than 5 characters.'); }); - it('should pass if the length is in the limit', function() { + it('should pass if the length is in the limit', function () { result = validator.validate('foo'); expect(result).toEqual({ isValid: true }); }); - it('should check the length of an integer', function() { + it('should check the length of an integer', function () { result = validator.validate(123); expect(result.isValid).toBe(true); }); - it('should fail if the length is not in the limit', function() { + it('should fail if the length is not in the limit', function () { result = validator.validate('foo-bar'); expect(result.isValid).toBe(false); }); - it('should have correct message on failure', function() { + it('should have correct message on failure', function () { result = validator.validate('foo-bar'); expect(result.message).toBe('Cannot be longer than 5 characters.'); }); diff --git a/spec/validators/range-validator-spec.js b/spec/validators/range-validator-spec.js index 3319c18..6179996 100644 --- a/spec/validators/range-validator-spec.js +++ b/spec/validators/range-validator-spec.js @@ -1,46 +1,46 @@ -describe('ko.validators.rangeValidator', function() { +describe('ko.validators.rangeValidator', function () { var validator, result; - beforeEach(function() { + beforeEach(function () { validator = ko.validators.rangeValidator(1, 10, 'Must be between 1 and 10.'); }); - it('should pass if value is a number within range', function() { + it('should pass if value is a number within range', function () { result = validator.validate(5); expect(result.isValid).toBe(true); }); - it('should pass if value is a string within range', function() { + it('should pass if value is a string within range', function () { result = validator.validate('5'); expect(result.isValid).toBe(true); }); - it('should fail if not a number', function() { + it('should fail if not a number', function () { result = validator.validate('10a'); expect(result.isValid).toBe(false); }); - it('should fail if not an integer', function() { + it('should fail if not an integer', function () { result = validator.validate('9.5'); expect(result.isValid).toBe(false); }); - it('should fail if less than range', function() { + it('should fail if less than range', function () { result = validator.validate(0); expect(result.isValid).toBe(false); }); - it('should fail if greater than range', function() { + it('should fail if greater than range', function () { result = validator.validate(11); expect(result.isValid).toBe(false); }); - it('should not provide error message when valid', function() { + it('should not provide error message when valid', function () { result = validator.validate(10); expect(result).toEqual({ isValid: true }); }); - it('should provide a meaningful error message when not valid', function() { + it('should provide a meaningful error message when not valid', function () { result = validator.validate(0); expect(result).toEqual({ isValid: false, diff --git a/spec/validators/required-validator-spec.js b/spec/validators/required-validator-spec.js index f67e4f3..932157b 100644 --- a/spec/validators/required-validator-spec.js +++ b/spec/validators/required-validator-spec.js @@ -13,7 +13,7 @@ describe('ko.validators.requiredValidator', function () { }); }); - it('is invalid if null', function() { + it('is invalid if null', function () { result = validator.validate(null); expect(result).toEqual({ isValid: false, @@ -21,7 +21,7 @@ describe('ko.validators.requiredValidator', function () { }); }); - it('is invalid if undefined', function() { + it('is invalid if undefined', function () { result = validator.validate(undefined); expect(result).toEqual({ isValid: false, @@ -29,7 +29,7 @@ describe('ko.validators.requiredValidator', function () { }); }); - it('is invalid if false', function() { + it('is invalid if false', function () { result = validator.validate(false); expect(result).toEqual({ isValid: false, @@ -37,7 +37,7 @@ describe('ko.validators.requiredValidator', function () { }); }); - it('is invalid if empty array', function() { + it('is invalid if empty array', function () { result = validator.validate([]); expect(result).toEqual({ isValid: false, @@ -60,7 +60,7 @@ describe('ko.validators.requiredValidator', function () { expect(result).toEqual({ isValid: true }); }); - it('is valid if not empty', function() { + it('is valid if not empty', function () { result = validator.validate('value'); expect(result).toEqual({ isValid: true }); });