express-partials
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -210,2 +210,6 @@ var ejs = require('ejs') | ||
// merge app locals into | ||
for(var k in this.app.locals) | ||
options[k] = options[k] || this.app.locals[k]; | ||
// extract object name from view | ||
@@ -212,0 +216,0 @@ name = options.as || resolveObjectName(view); |
@@ -5,3 +5,3 @@ { | ||
"description": "Express 3.x Layout & Partial support.", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "https://github.com/publicclass/express-partials" |
@@ -9,2 +9,6 @@ var express = require('express') | ||
app.locals.use(function(req,res){ | ||
app.locals.hello = 'there'; | ||
}) | ||
app.get('/',function(req,res,next){ | ||
@@ -18,2 +22,10 @@ res.render('index.ejs') | ||
app.get('/res-locals',function(req,res,next){ | ||
res.render('locals.ejs',{hello:'here'}) | ||
}) | ||
app.get('/app-locals',function(req,res,next){ | ||
res.render('locals.ejs') | ||
}) | ||
app.get('/mobile',function(req,res,next){ | ||
@@ -60,2 +72,26 @@ res.render('index.ejs',{layout:'mobile'}) | ||
describe('GET /res-locals',function(){ | ||
it('should render "here"',function(done){ | ||
request(app) | ||
.get('/res-locals') | ||
.end(function(res){ | ||
res.should.have.status(200); | ||
res.body.should.equal('<html><head><title>express-partials</title></head><body><h1>here</h1></body></html>'); | ||
done(); | ||
}) | ||
}) | ||
}) | ||
describe('GET /app-locals',function(){ | ||
it('should render "there"',function(done){ | ||
request(app) | ||
.get('/app-locals') | ||
.end(function(res){ | ||
res.should.have.status(200); | ||
res.body.should.equal('<html><head><title>express-partials</title></head><body><h1>there</h1></body></html>'); | ||
done(); | ||
}) | ||
}) | ||
}) | ||
describe('GET /mobile',function(){ | ||
@@ -62,0 +98,0 @@ it('should render with mobile.ejs as layout',function(done){ |
15822
12
445