Skip to content
Myr

Added <root>/_<name> partial lookup support

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 92c04ce · Browse files · 4 files+15 added−0 removed
This commit

State

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

Diff stats

4 files+15 added−0 removed

  • tests:+12 added−0 removed
  • other:+3 added−0 removed

4 files+15 added−0 removed

modified:lib/view.js+3 added
296 unmodified lines
297298 // Try root ex: <root>/user.jade299 if (!view.exists) view = new View(orig.rootPath, options);300301 // Try root _ prefix ex: <root>/_user.jade302 if (!view.exists && partial) view = new View(view.prefixPath, options);303304 // Does not exist305 if (!view.exists) {306 if (app.enabled('hints')) hintAtViewPaths(orig, options);307 throw new Error('failed to locate view "' + orig.view + '"');
73 unmodified lines
added:test/fixtures/nested/partial2.jade+1 added
1!= partial('messages')
added:test/fixtures/_messages.jade+1 added
1p Testing
modified:test/view.test.js+10 added
607 unmodified lines
608609 assert.response(app,610 { url: '/root' },611 { body: '<p>Hits 15</p><p>Misses 1</p>' });612613 // root _* lookup614615 app.get('/root/underscore', function(req, res){616 res.partial('nested/partial2');617 });618619 assert.response(app,620 { url: '/root/underscore' },621 { body: '<p>Testing</p>' });622 },623 624 'test #partial() with several calls': function(){625 var app = create();
419 unmodified lines