diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-05-11 14:45:54 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-05-11 14:45:54 +0200 |
commit | 961d43f085036263edfe064c2107ab27ad62d8fa (patch) | |
tree | 49c845d9d9e11e0abaf94094a4aab263921216bb /lib/templating/__tests__ | |
parent | 7bd49606e3aceb4078258c6693f53bc129eb5b93 (diff) | |
download | gitbook-961d43f085036263edfe064c2107ab27ad62d8fa.zip gitbook-961d43f085036263edfe064c2107ab27ad62d8fa.tar.gz gitbook-961d43f085036263edfe064c2107ab27ad62d8fa.tar.bz2 |
Fix #1293: replace block shortcuts when including files
Diffstat (limited to 'lib/templating/__tests__')
-rw-r--r-- | lib/templating/__tests__/replaceShortcuts.js | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/templating/__tests__/replaceShortcuts.js b/lib/templating/__tests__/replaceShortcuts.js index bd94f29..216a1c8 100644 --- a/lib/templating/__tests__/replaceShortcuts.js +++ b/lib/templating/__tests__/replaceShortcuts.js @@ -1,27 +1,26 @@ -var TemplateEngine = require('../../models/templateEngine'); +var Immutable = require('immutable'); + var TemplateBlock = require('../../models/templateBlock'); var replaceShortcuts = require('../replaceShortcuts'); describe('replaceShortcuts', function() { - var engine = TemplateEngine.create({ - blocks:[ - TemplateBlock.create('math', { - shortcuts: { - start: '$$', - end: '$$', - parsers: ['markdown'] - } - }) - ] - }); + var blocks = Immutable.List([ + TemplateBlock.create('math', { + shortcuts: { + start: '$$', + end: '$$', + parsers: ['markdown'] + } + }) + ]); it('should correctly replace inline matches by block', function() { - var content = replaceShortcuts(engine, 'test.md', 'Hello $$a = b$$'); + var content = replaceShortcuts(blocks, 'test.md', 'Hello $$a = b$$'); expect(content).toBe('Hello {% math %}a = b{% endmath %}'); }); it('should correctly replace block matches', function() { - var content = replaceShortcuts(engine, 'test.md', 'Hello\n$$\na = b\n$$\n'); + var content = replaceShortcuts(blocks, 'test.md', 'Hello\n$$\na = b\n$$\n'); expect(content).toBe('Hello\n{% math %}\na = b\n{% endmath %}\n'); }); }); |