diff options
author | Samy Pesse <samypesse@gmail.com> | 2015-06-18 11:15:44 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2015-06-18 11:15:44 +0200 |
commit | 84b6e0bde6547421b3b42bb9a1754ae980c8aea1 (patch) | |
tree | 8be7e07101270c48b0fef236974af8ea8a978e56 | |
parent | abc29c3fbaa2579f8f7c1f7ec0cef5b4241d7271 (diff) | |
download | gitbook-84b6e0bde6547421b3b42bb9a1754ae980c8aea1.zip gitbook-84b6e0bde6547421b3b42bb9a1754ae980c8aea1.tar.gz gitbook-84b6e0bde6547421b3b42bb9a1754ae980c8aea1.tar.bz2 |
Add test for kwargs
-rw-r--r-- | test/plugins.js | 7 | ||||
-rw-r--r-- | test/plugins/blocks/index.js | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/test/plugins.js b/test/plugins.js index 02b7627..e3d0c49 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -192,6 +192,13 @@ describe('Plugins', function () { content.should.equal("test5a,b,ctest5"); }); }); + + it('should correctly extend template blocks with args and kwargs', function() { + return testTpl('{% test5kwargs "a", "b", "c", d="test", e="test2" %}{% endtest5kwargs %}') + .then(function(content) { + content.should.equal("test5a,b,c,d:test,e:test2,__keywords:truetest5"); + }); + }); }); }); diff --git a/test/plugins/blocks/index.js b/test/plugins/blocks/index.js index c69801e..0848238 100644 --- a/test/plugins/blocks/index.js +++ b/test/plugins/blocks/index.js @@ -42,5 +42,15 @@ module.exports = { return "test5"+blk.args.join(',')+"test5"; } }, + "test5kwargs": { + process: function(blk) { + var s = blk.args.join(','); + for (var key in blk.kwargs) { + s = s + ','+key+':'+blk.kwargs[key]; + } + + return "test5"+s+"test5"; + } + }, } };
\ No newline at end of file |