UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

35 lines 1.11 kB
// Generated by github.com/steida/coffee2closure 900.1.18 suite('este.validators.format', function() { var format; format = null; setup(function() { return format = este.validators.format(/^\d+$/)(); }); suite('validate', function() { suite('should be valid:', function() { return test('123', function() { format.value = '123'; return assert.isTrue(format.validate()); }); }); return suite('should be invalid:', function() { return test('foo@@bla.com', function() { format.value = 'foo@@bla.com'; return assert.isFalse(format.validate()); }); }); }); return suite('getMsg', function() { test('should return message', function() { return assert.equal(format.getMsg(), 'Please enter a value in correct format.'); }); return test('should return alternative message', function() { var getMsg; getMsg = function() { return 'This is not format.'; }; format = este.validators.format(/^\d+$/, getMsg)(); return assert.equal(format.getMsg(), getMsg()); }); }); });