hmpo-form-controller
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -17,3 +17,3 @@ /*eslint no-unused-vars: [2, {"vars": "all", "args": "none"}]*/ | ||
if (!options.template) { | ||
throw new Error('A template must be provided'); | ||
debug('No template provided'); | ||
} | ||
@@ -101,3 +101,7 @@ options.defaultFormatters = options.defaultFormatters || ['trim', 'singlespaces', 'hyphens']; | ||
render: function (req, res, callback) { | ||
res.render(this.options.template); | ||
if (!this.options.template) { | ||
callback(new Error('A template must be provided')); | ||
} else { | ||
res.render(this.options.template); | ||
} | ||
}, | ||
@@ -104,0 +108,0 @@ _getErrors: function (req, res, callback) { |
{ | ||
"name": "hmpo-form-controller", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,7 +24,7 @@ var Form = require('../../'); | ||
it('throws if template is undefined', function () { | ||
it('doesn\'t throw if template is undefined', function () { | ||
var fn = function () { | ||
return new Form({}); | ||
}; | ||
fn.should.throw(); | ||
fn.should.not.throw(); | ||
}); | ||
@@ -551,2 +551,9 @@ | ||
it('throws an error if no template provided', function () { | ||
var err = new Error('A template must be provided'); | ||
form.options.template = undefined; | ||
form.render(req, res, cb); | ||
cb.should.have.been.calledOnce.and.calledWithExactly(err); | ||
}); | ||
}); | ||
@@ -553,0 +560,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92261
2201