UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

40 lines 1.29 kB
// Generated by github.com/steida/coffee2closure 900.1.18 suite('este.validators.exclusion', function() { var exclusion; exclusion = null; setup(function() { return exclusion = este.validators.exclusion(['Foo', 'Bla'])(); }); suite('validate', function() { suite('should be valid:', function() { return test('"a"', function() { exclusion.value = 'a'; return assert.isTrue(exclusion.validate()); }); }); return suite('should be invalid:', function() { test('"Foo"', function() { exclusion.value = 'Foo'; return assert.isFalse(exclusion.validate()); }); return test('"Bla"', function() { exclusion.value = 'Bla'; return assert.isFalse(exclusion.validate()); }); }); }); return suite('getMsg', function() { test('should return message', function() { exclusion.value = 'Foo'; return assert.equal(exclusion.getMsg(), '\'Foo\' is not allowed.'); }); return test('should return alternative message', function() { var getMsg; getMsg = function() { return "Foo " + this.exclusion; }; exclusion = este.validators.exclusion(['Foo', 'Bla'], getMsg)(); return assert.equal(exclusion.getMsg(), 'Foo Foo,Bla'); }); }); });