Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix nested locals rendering with partials

  • Loading branch information...
commit 1f573dab9b53cb9ee095b9af66e6cf4d65785ea0 1 parent f72042e
@aheckmann aheckmann authored
View
1  .gitignore
@@ -1,3 +1,4 @@
*.swp
*.swn
*.swo
+node_modules/
View
5 index.js
@@ -98,10 +98,11 @@ function resolve (options, callback, nested) {
// locals support
if (options.locals) {
- resolve(options.locals, function (err, resolved) {
+ return resolve(options.locals, function (err, resolved) {
if (err) return error(err);
options.locals = resolved;
- --pending || callback(null, options);
+ if (--pending) return;
+ return callback(null, options);
}, true);
}
View
1  test/fixtures/nested-partial.jade
@@ -0,0 +1 @@
+li= title
View
2  test/fixtures/nested.jade
@@ -0,0 +1,2 @@
+ul
+ != partial('nested-partial')
View
18 test/index.js
@@ -196,6 +196,14 @@ function assignExports () {
});
});
+ app.get('/renderlocalsonlynest', function (req, res) {
+ res.render('nested', {
+ locals: {
+ title: 'yes'
+ }
+ });
+ });
+
app.get('/renderbothnesterror', function (req, res) {
res.render('both', {
locals: {
@@ -207,7 +215,7 @@ function assignExports () {
// test
- var pending = 6;
+ var pending = 7;
function done () {
if (--pending) return;
db.close();
@@ -255,6 +263,14 @@ function assignExports () {
);
assert.response(app,
+ { url: '/renderlocalsonlynest' }
+ , { status: 200
+ , body: '<ul><li>yes</li></ul>'
+ }
+ , done
+ );
+
+ assert.response(app,
{ url: '/renderqueryerror' }
, function (res) {
assert.equal(res.statusCode, 500);
Please sign in to comment.
Something went wrong with that request. Please try again.