diff options
author | Samy Pesse <samypesse@gmail.com> | 2015-09-14 11:28:14 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2015-09-14 11:28:14 +0200 |
commit | fa4e234bab15db4b0a8a0a13f041ef5869a2458b (patch) | |
tree | 243816b5b7a243915b44a590cb40e5ce4c731b21 /test/codehighlighting.js | |
parent | 35c4179ca12a0287279ced0535f11237cdf606ec (diff) | |
download | gitbook-fa4e234bab15db4b0a8a0a13f041ef5869a2458b.zip gitbook-fa4e234bab15db4b0a8a0a13f041ef5869a2458b.tar.gz gitbook-fa4e234bab15db4b0a8a0a13f041ef5869a2458b.tar.bz2 |
Add base test for extending code highlighting
Diffstat (limited to 'test/codehighlighting.js')
-rw-r--r-- | test/codehighlighting.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/codehighlighting.js b/test/codehighlighting.js new file mode 100644 index 0000000..a64bf4b --- /dev/null +++ b/test/codehighlighting.js @@ -0,0 +1,34 @@ +var _ = require('lodash'); +var should = require('should'); +var path = require('path'); +var fs = require('fs'); + +var Plugin = require('../lib/plugin'); +var PLUGINS_ROOT = path.resolve(__dirname, 'plugins'); + +describe('Code Highlighting', function () { + it('should correctly replace highlighting', function() { + return books.generate('highlight', 'website', { + prepare: function(book) { + var plugin = new Plugin(book, "highlight"); + plugin.load("./highlight", PLUGINS_ROOT); + + book.plugins.load(plugin); + } + }) + .then(function(book) { + 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' + } + }); + }); + }); +}); + |