Skip to content

Commit ff1cabe

Browse files
committed
update underscore partial testing to match other partial testing
1 parent 9b4d450 commit ff1cabe

File tree

3 files changed

+15
-31
lines changed

3 files changed

+15
-31
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<p><%- user.name %></p><%= partials.partial(user) %>
1+
<%= partials.partial({user: user}) %>

test/fixtures/underscore/user_partial.underscore

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/shared/partials.js

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@ exports.test = function(name) {
1414
fs.readFileSync = readFileSync;
1515
});
1616

17-
if (name === 'hogan' || name === 'mustache' || name === 'handlebars' || name === 'ractive') {
17+
if (name === 'dust' || name === 'arc-templates') {
18+
it('should support rendering a partial', function(done) {
19+
var str = fs.readFileSync('test/fixtures/' + name + '/user_partial.' + name).toString();
20+
var locals = {
21+
user: user,
22+
views: './test/fixtures/' + name
23+
};
24+
cons[name].render(str, locals, function(err, html) {
25+
if (err) return done(err);
26+
html.should.equal('<p>Tobi from partial!</p><p>Tobi</p>');
27+
done();
28+
});
29+
});
30+
} else {
1831
it('should support partials', function(done) {
1932
var path = 'test/fixtures/' + name + '/partials.' + name;
2033
var locals = { user: user, partials: { partial: 'user' } };
@@ -42,34 +55,6 @@ exports.test = function(name) {
4255
done();
4356
});
4457
});
45-
} else if (name === 'underscore') {
46-
it('should support partials', function(done) {
47-
var path = 'test/fixtures/' + name + '/partials.' + name;
48-
var locals = {
49-
user: user,
50-
partials: {
51-
partial: 'user_partial'
52-
}
53-
};
54-
cons[name](path, locals, function(err, html) {
55-
if (err) return done(err);
56-
html.should.equal('<p>Tobi</p><p>Tobi from user_partial!</p>');
57-
done();
58-
});
59-
});
60-
} else {
61-
it('should support rendering a partial', function(done) {
62-
var str = fs.readFileSync('test/fixtures/' + name + '/user_partial.' + name).toString();
63-
var locals = {
64-
user: user,
65-
views: './test/fixtures/' + name
66-
};
67-
cons[name].render(str, locals, function(err, html) {
68-
if (err) return done(err);
69-
html.should.equal('<p>Tobi from partial!</p><p>Tobi</p>');
70-
done();
71-
});
72-
});
7358
}
7459
});
7560
};

0 commit comments

Comments
 (0)