mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-03 12:10:34 +00:00
Add base test for extending code highlighting
This commit is contained in:
@@ -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'
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user