Permalink
Browse files

fix nested locals rendering with partials

  • Loading branch information...
aheckmann committed Sep 13, 2011
1 parent f72042e commit 1f573dab9b53cb9ee095b9af66e6cf4d65785ea0
Showing with 24 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +3 −2 index.js
  3. +1 −0 test/fixtures/nested-partial.jade
  4. +2 −0 test/fixtures/nested.jade
  5. +17 −1 test/index.js
View
@@ -1,3 +1,4 @@
*.swp
*.swn
*.swo
+node_modules/
View
@@ -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);
}
@@ -0,0 +1 @@
+li= title
@@ -0,0 +1,2 @@
+ul
+ != partial('nested-partial')
View
@@ -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();
@@ -254,6 +262,14 @@ function assignExports () {
, done
);
+ assert.response(app,
+ { url: '/renderlocalsonlynest' }
+ , { status: 200
+ , body: '<ul><li>yes</li></ul>'
+ }
+ , done
+ );
+
assert.response(app,
{ url: '/renderqueryerror' }
, function (res) {

0 comments on commit 1f573da

Please sign in to comment.