summaryrefslogtreecommitdiffstats
path: root/test/template.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-04-30 22:06:16 +0200
committerSamy Pesse <samypesse@gmail.com>2016-04-30 22:06:16 +0200
commitc1d53ec11fbe085932df911bda5686b7bf671f53 (patch)
tree97ae6db641eb79ec9b061af136a0b2e3c549db55 /test/template.js
parent36b49c66c6b75515bc84dd678fd52121a313e8d2 (diff)
downloadgitbook-c1d53ec11fbe085932df911bda5686b7bf671f53.zip
gitbook-c1d53ec11fbe085932df911bda5686b7bf671f53.tar.gz
gitbook-c1d53ec11fbe085932df911bda5686b7bf671f53.tar.bz2
Switch parsers to a model
Diffstat (limited to 'test/template.js')
-rw-r--r--test/template.js54
1 files changed, 0 insertions, 54 deletions
diff --git a/test/template.js b/test/template.js
deleted file mode 100644
index 6eb2278..0000000
--- a/test/template.js
+++ /dev/null
@@ -1,54 +0,0 @@
-var mock = require('./mock');
-var Output = require('../lib/output/base');
-
-describe('Template', function() {
- var output;
-
- before(function() {
- return mock.outputDefaultBook(Output, {})
- .then(function(_output) {
- output = _output;
- });
- });
-
- describe('.renderString', function() {
- it('should render a simple string', function() {
- return output.template.renderString('Hello World')
- .should.be.fulfilledWith('Hello World');
- });
-
- it('should render with variable', function() {
- return output.template.renderString('Hello {{ world }}', { world: 'World'})
- .should.be.fulfilledWith('Hello World');
- });
- });
-
- 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 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 + '!';
- });
-
- return output.template.renderString('{% sayhello_kwargs name="World" %}{% endsayhello_kwargs %}')
- .should.be.fulfilledWith('Hello World!');
- });
- });
-});