diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-15 14:19:30 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-15 14:19:30 +0100 |
commit | 1141d34f07ca4a9937dd4f43b43e5faa01da832c (patch) | |
tree | a222b2c14b1f0013727f0c150d487b42b6a890a4 | |
parent | 354fe1274242bef87b739dbe43cdb634ea573662 (diff) | |
download | gitbook-1141d34f07ca4a9937dd4f43b43e5faa01da832c.zip gitbook-1141d34f07ca4a9937dd4f43b43e5faa01da832c.tar.gz gitbook-1141d34f07ca4a9937dd4f43b43e5faa01da832c.tar.bz2 |
Add tests for args in blocks
-rw-r--r-- | test/template.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/template.js b/test/template.js index d12a641..a76fe93 100644 --- a/test/template.js +++ b/test/template.js @@ -34,6 +34,15 @@ describe('Template', function() { .should.be.fulfilledWith('Hello World!'); }); + it('should correctly add a block with args', function() { + output.template.addBlock('sayhello_args', function(blk) { + return 'Hello ' + blk.args[0] + '!'; + }); + + return output.template.renderString('{% sayhello_args "World" %}{% endsayhello_args %}') + .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 + '!'; |