UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

39 lines 1.14 kB
// Generated by github.com/steida/coffee2closure 900.1.18 suite('este.validators.max', function() { var max; max = null; setup(function() { return max = este.validators.max(3)(); }); suite('validate', function() { suite('should be valid:', function() { return test('3', function() { max.value = 3; return assert.isTrue(max.validate()); }); }); return suite('should be invalid:', function() { test('4', function() { max.value = 4; return assert.isFalse(max.validate()); }); return test('"4"', function() { max.value = '4'; return assert.isFalse(max.validate()); }); }); }); return suite('getMsg', function() { test('should return message', function() { return assert.equal(max.getMsg(), 'Please enter a value less than or equal to 3.'); }); return test('should return alternative message', function() { var getMsg; getMsg = function() { return "Foo " + this.max; }; max = este.validators.max(3, getMsg)(); return assert.equal(max.getMsg(), 'Foo 3'); }); }); });