Skip to content
Myr

Added partial tests for collection locals + passed locals

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent be85701 · Browse files · 3 files+16 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+16 added−4 removed

  • tests:+16 added−4 removed

3 files+16 added−4 removed

added:test/fixtures/partials/hello.ejs+1 added
1Hello
modified:test/fixtures/partials/person.jade+1 added-1 removed
1p= this.name1p #{label} #{this.name}
modified:test/view.test.js+14 added-3 removed
157 unmodified lines
158 // as: this collection option159 app.get('/person', function(req, res){160 res.send(res.partial('person.jade', {161 as: this,162 collection: [{ name: 'tj' }]162 collection: [{ name: 'tj' }],163 locals: { label: 'name:' }164 }));165 });166 167 assert.response(app,168 { url: '/person' },168 { body: '<p>tj</p>' });169 { body: '<p>name: tj</p>' });170171 // as: global collection option172 app.get('/videos', function(req, res){173 res.send(res.partial('video.jade', {
43 unmodified lines
217218 app.get('/person-this', function(req, res){219 res.send(res.partial('person.jade', {220 object: { name: 'tj' },221 locals: { label: 'User:' },222 as: this223 })); 224 });225 226 // Non-collection as: this227 assert.response(app,228 { url: '/person-this' },227 { body: '<p>tj</p>' });229 { body: '<p>User: tj</p>' });230 231 // No options232 app.get('/nothing', function(req, res){233 res.send(res.partial('hello.ejs'));234 });235 236 assert.response(app,237 { url: '/nothing' },238 { body: 'Hello' });239 }240};