summaryrefslogtreecommitdiffstats
path: root/test/plugins.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-10-20 16:38:48 +0200
committerSamy Pessé <samypesse@gmail.com>2015-10-20 16:38:48 +0200
commit991681daa2357b8649e40ae9f04e58c88ba0d23f (patch)
treea245373d41ec79c7807c9fa84757b8ccc7ede2a9 /test/plugins.js
parent2faf53e16b3e0e401264af214ea6614f9b46103d (diff)
downloadgitbook-991681daa2357b8649e40ae9f04e58c88ba0d23f.zip
gitbook-991681daa2357b8649e40ae9f04e58c88ba0d23f.tar.gz
gitbook-991681daa2357b8649e40ae9f04e58c88ba0d23f.tar.bz2
Add failing test for #982
Diffstat (limited to 'test/plugins.js')
-rw-r--r--test/plugins.js47
1 files changed, 41 insertions, 6 deletions
diff --git a/test/plugins.js b/test/plugins.js
index db2d225..1600d0d 100644
--- a/test/plugins.js
+++ b/test/plugins.js
@@ -1,4 +1,5 @@
var _ = require('lodash');
+var fs = require('fs');
var should = require('should');
var path = require('path');
@@ -193,15 +194,49 @@ describe('Plugins', function () {
});
});
- it('should correctly accept shortcuts', function() {
- return testTpl('$$hello$$', {}, {
- type: 'markdown'
- })
- .then(function(content) {
- content.should.equal('testhellotest');
+ describe('Shortcuts', function() {
+ it('should correctly accept shortcuts', function() {
+ return testTpl('$$hello$$', {}, {
+ type: 'markdown'
+ })
+ .then(function(content) {
+ content.should.equal('testhellotest');
+ });
+ });
+
+ it('should correctly apply shortcuts to included file', function() {
+ return books.generate('conrefs', 'website', {
+ testId: 'include-plugins',
+ prepare: function(bookConref) {
+ plugin = new Plugin(bookConref, 'blocks');
+ plugin.load('./blocks', PLUGINS_ROOT);
+
+ return bookConref.plugins.load(plugin);
+ }
+ })
+ .then(function(bookConref) {
+ var readme = fs.readFileSync(
+ path.join(bookConref.options.output, 'index.html'),
+ { encoding: 'utf-8' }
+ );
+
+ readme.should.be.html({
+ '.page-inner p#test-plugin-block-shortcuts-1': {
+ count: 1,
+ text: 'testtest_block1test',
+ trim: true
+ },
+ '.page-inner p#test-plugin-block-shortcuts-2': {
+ count: 1,
+ text: 'testtest_block2test',
+ trim: true
+ }
+ });
+ });
});
});
+
it('should correctly extend template blocks with defined end', function() {
return testTpl('{% test2 %}hello{% endtest2end %}')
.then(function(content) {