este-library-oldschool
Version:
Library for github.com/steida/este.git
39 lines • 1.3 kB
JavaScript
// Generated by github.com/steida/coffee2closure 900.1.18
suite('este.validators.minLength', function() {
var minLength;
minLength = null;
setup(function() {
return minLength = este.validators.minLength(3)();
});
suite('validate', function() {
suite('should be valid:', function() {
return test('should return true for abc', function() {
minLength.value = 'abc';
return assert.isTrue(minLength.validate());
});
});
return suite('should be invalid:', function() {
test('should return false for ab', function() {
minLength.value = 'ab';
return assert.isFalse(minLength.validate());
});
return test('should return false for ""', function() {
minLength.value = '';
return assert.isFalse(minLength.validate());
});
});
});
return suite('getMsg', function() {
test('should return message', function() {
return assert.equal(minLength.getMsg(), 'Please enter at least 3 characters.');
});
return test('should return alternative message', function() {
var getMsg;
getMsg = function() {
return "Foo " + this.minLength;
};
minLength = este.validators.minLength(3, getMsg)();
return assert.equal(minLength.getMsg(), 'Foo 3');
});
});
});