este-library-oldschool
Version:
Library for github.com/steida/este.git
32 lines • 1.03 kB
JavaScript
// Generated by github.com/steida/coffee2closure 900.1.18
suite('este.validators.url', function() {
var url;
url = null;
setup(function() {
return url = este.validators.url()();
});
suite('validate', function() {
test('should return true for valid url', function() {
url.value = 'http://github.com/steida/este';
return assert.isTrue(url.validate());
});
return test('should return false for invalid url', function() {
url.value = 'http:///foo';
return assert.isFalse(url.validate());
});
});
return suite('getMsg', function() {
test('should return message', function() {
return assert.equal(url.getMsg(), 'Please enter a valid URL.');
});
return test('should return alternative message', function() {
var getMsg;
getMsg = function() {
return "Foo " + this.url;
};
url = este.validators.url(getMsg)();
url.url = 'http://google.com';
return assert.equal(url.getMsg(), 'Foo http://google.com');
});
});
});