summaryrefslogtreecommitdiffstats
path: root/test/template.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/template.js')
-rw-r--r--test/template.js24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/template.js b/test/template.js
index 536043d..d12a641 100644
--- a/test/template.js
+++ b/test/template.js
@@ -6,9 +6,7 @@ describe('Template', function() {
var output;
before(function() {
- return mock.outputDefaultBook(Output, {
- 'test.md': 'World'
- })
+ return mock.outputDefaultBook(Output, {})
.then(function(_output) {
output = _output;
});
@@ -25,4 +23,24 @@ describe('Template', function() {
.should.be.fulfilledWith('Version is '+pkg.version);
});
});
+
+ describe('Blocks', function() {
+ it('should correctly add a block', function() {
+ output.template.addBlock('sayhello', function(blk) {
+ return 'Hello ' + blk.body + '!';
+ });
+
+ return output.template.renderString('{% sayhello %}World{% endsayhello %}')
+ .should.be.fulfilledWith('Hello World!');
+ });
+
+ it('should correctly add a block with kwargs', function() {
+ output.template.addBlock('sayhello_kwargs', function(blk) {
+ return 'Hello ' + blk.kwargs.name + '!';
+ });
+
+ return output.template.renderString('{% sayhello_kwargs name="World" %}{% endsayhello_kwargs %}')
+ .should.be.fulfilledWith('Hello World!');
+ });
+ });
});