Skip to content

Commit

Permalink
Added test fixtures for underscore partial support
Browse files Browse the repository at this point in the history
Added test fixtures and a test for the added support of underscore
partials.
  • Loading branch information
jaysonpotter committed Mar 16, 2018
1 parent dda9fdd commit f9a1790
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ require('./shared').test('handlebars');
require('./shared/partials').test('handlebars');
require('./shared/helpers').test('handlebars');
require('./shared').test('underscore');
require('./shared/partials').test('underscore');
require('./shared').test('lodash');
require('./shared').test('qejs');
require('./shared').test('walrus');
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/underscore/partials.underscore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p><%- user.name %></p><%= partials.partial(user) %>
1 change: 1 addition & 0 deletions test/fixtures/underscore/user_partial.underscore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p><%- name %> from user_partial!</p>
18 changes: 16 additions & 2 deletions test/shared/partials.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,22 @@ exports.test = function(name) {
done();
});
});
}
else {
} else if (name == 'underscore') {
it('should support partials', function(done){
var path = 'test/fixtures/' + name + '/partials.' + name;
var locals = {
user: user,
partials: {
partial: 'user_partial'
}
};
cons[name](path, locals, function(err, html){
if (err) return done(err);
html.should.equal('<p>Tobi</p><p>Tobi from user_partial!</p>');
done();
});
});
} else {
it('should support rendering a partial', function(done){
var str = fs.readFileSync('test/fixtures/' + name + '/user_partial.' + name).toString();
var locals = {
Expand Down

0 comments on commit f9a1790

Please sign in to comment.