diff options
author | Samy Pesse <samypesse@gmail.com> | 2015-09-08 23:55:30 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2015-09-08 23:55:30 +0200 |
commit | 41e5ca8422357797c698180b3d0798f2b907e4cd (patch) | |
tree | 2992dfcd0d6365ff68f2d8c89148ae6231d41cc2 | |
parent | 53af8b2bb661e5aebb6732bee24464e2b1068994 (diff) | |
download | gitbook-41e5ca8422357797c698180b3d0798f2b907e4cd.zip gitbook-41e5ca8422357797c698180b3d0798f2b907e4cd.tar.gz gitbook-41e5ca8422357797c698180b3d0798f2b907e4cd.tar.bz2 |
Add test for blocks without parsing
-rw-r--r-- | test/plugins.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/plugins.js b/test/plugins.js index e3d0c49..2309395 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -3,6 +3,7 @@ var should = require('should'); var path = require('path'); var Plugin = require('../lib/plugin'); +var parsers = require("gitbook-parsers"); var PLUGINS_ROOT = path.resolve(__dirname, 'plugins'); describe('Plugins', function () { @@ -200,5 +201,38 @@ describe('Plugins', function () { }); }); }); + + describe('Blocks without parsing', function() { + var plugin; + + before(function() { + plugin = new Plugin(book, "blocks"); + plugin.load("./blocks", PLUGINS_ROOT); + + return book.plugins.load(plugin); + }); + + var testTpl = function(markup, str, args, options) { + var filetype = parsers.get(markup); + + return book.template.renderString(str, args, options) + .then(filetype.page).get('sections').get(0).get('content') + .then(book.template.postProcess) + }; + + it('should correctly process unparsable for markdown', function() { + return testTpl('.md', '{% test %}**hello**{% endtest %}') + .then(function(content) { + content.should.equal("<p>test**hello**test</p>\n"); + }); + }); + + it('should correctly process unparsable for asciidoc', function() { + return testTpl('.adoc', '{% test %}**hello**{% endtest %}') + .then(function(content) { + content.should.equal('<div class="paragraph">\n<p>test**hello**test</p>\n</div>\n'); + }); + }); + }); }); |