summaryrefslogtreecommitdiffstats
path: root/test/plugins.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2015-09-12 18:21:35 +0200
committerSamy Pesse <samypesse@gmail.com>2015-09-12 18:21:35 +0200
commit82a6ee3875bca2b068d76ccc894c4313d1006b77 (patch)
tree0ad9e753629774333ec163f21234fc770c10a541 /test/plugins.js
parent3bf592f870eb24d1b4753fa538bad2cbfaa98a24 (diff)
downloadgitbook-82a6ee3875bca2b068d76ccc894c4313d1006b77.zip
gitbook-82a6ee3875bca2b068d76ccc894c4313d1006b77.tar.gz
gitbook-82a6ee3875bca2b068d76ccc894c4313d1006b77.tar.bz2
Add test for replacing highlighting
Diffstat (limited to 'test/plugins.js')
-rw-r--r--test/plugins.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/plugins.js b/test/plugins.js
index d10e0b5..a81110c 100644
--- a/test/plugins.js
+++ b/test/plugins.js
@@ -1,6 +1,7 @@
var _ = require('lodash');
var should = require('should');
var path = require('path');
+var fs = require('fs');
var Plugin = require('../lib/plugin');
var parsers = require("gitbook-parsers");
@@ -234,5 +235,31 @@ describe('Plugins', function () {
});
});
});
+
+ describe('Replace code highlighting', function() {
+ it('should correctly replace highlighting', function() {
+ return books.generate('basic', 'website', {
+ before: function(book) {
+ var plugin = new Plugin(book, "blocks");
+ plugin.load("./highlight", PLUGINS_ROOT);
+
+ return book.plugins.load(plugin);
+ }
+ })
+ .then(function() {
+ var PAGE = fs.readFileSync(
+ path.join(book.options.output, "index.html"),
+ { encoding: "utf-8" }
+ );
+
+ PAGE.should.be.html({
+ "code": {
+ count: 1,
+ text: 'code__test\n__code'
+ }
+ });
+ });
+ })
+ });
});