Skip to content

Commit

Permalink
update underscore partial testing to match other partial testing
Browse files Browse the repository at this point in the history
  • Loading branch information
doowb committed Mar 19, 2018
1 parent 9b4d450 commit ff1cabe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/underscore/partials.underscore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p><%- user.name %></p><%= partials.partial(user) %>
<%= partials.partial({user: user}) %>
1 change: 0 additions & 1 deletion test/fixtures/underscore/user_partial.underscore

This file was deleted.

43 changes: 14 additions & 29 deletions test/shared/partials.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ exports.test = function(name) {
fs.readFileSync = readFileSync;
});

if (name === 'hogan' || name === 'mustache' || name === 'handlebars' || name === 'ractive') {
if (name === 'dust' || name === 'arc-templates') {
it('should support rendering a partial', function(done) {
var str = fs.readFileSync('test/fixtures/' + name + '/user_partial.' + name).toString();
var locals = {
user: user,
views: './test/fixtures/' + name
};
cons[name].render(str, locals, function(err, html) {
if (err) return done(err);
html.should.equal('<p>Tobi from partial!</p><p>Tobi</p>');
done();
});
});
} else {
it('should support partials', function(done) {
var path = 'test/fixtures/' + name + '/partials.' + name;
var locals = { user: user, partials: { partial: 'user' } };
Expand Down Expand Up @@ -42,34 +55,6 @@ exports.test = function(name) {
done();
});
});
} 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 = {
user: user,
views: './test/fixtures/' + name
};
cons[name].render(str, locals, function(err, html) {
if (err) return done(err);
html.should.equal('<p>Tobi from partial!</p><p>Tobi</p>');
done();
});
});
}
});
};

0 comments on commit ff1cabe

Please sign in to comment.