diff options
author | James Phillpotts <jphillpotts@scottlogic.co.uk> | 2014-04-10 11:00:52 +0100 |
---|---|---|
committer | James Phillpotts <jphillpotts@scottlogic.co.uk> | 2014-04-10 11:00:52 +0100 |
commit | 8f457a752eef936eba95ce3de7bb8e490b1ba4ea (patch) | |
tree | a78944a4313785bd373b9f54f46afcfe392f1345 /test | |
parent | 435a4b8c99ae739316af1bf5db9fcc8b0cd104ef (diff) | |
download | gitbook-8f457a752eef936eba95ce3de7bb8e490b1ba4ea.zip gitbook-8f457a752eef936eba95ce3de7bb8e490b1ba4ea.tar.gz gitbook-8f457a752eef936eba95ce3de7bb8e490b1ba4ea.tar.bz2 |
Use OS-agnostic path generation for images too
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/PAGE.md | 3 | ||||
-rw-r--r-- | test/page.js | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/fixtures/PAGE.md b/test/fixtures/PAGE.md index 92ee707..7dcaa40 100644 --- a/test/fixtures/PAGE.md +++ b/test/fixtures/PAGE.md @@ -31,6 +31,9 @@ Some more nice content .... [Link to another Markdown file](./xyz/file.md) +And look at this pretty picture: + + Lets go for another exercise but this time with some context : --- diff --git a/test/page.js b/test/page.js index 658559e..fa6db06 100644 --- a/test/page.js +++ b/test/page.js @@ -6,7 +6,10 @@ var page = require('../').parse.page; var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/PAGE.md'), 'utf8'); -var LEXED = page(CONTENT); +var LEXED = page(CONTENT, { + dir: 'course', + outdir: '_book' +}); var HR_CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/HR_PAGE.md'), 'utf8'); var HR_LEXED = page(HR_CONTENT); @@ -30,6 +33,10 @@ describe('Page parsing', function() { assert(LEXED[2].content); }); + it('should make image URLs relative', function() { + assert(LEXED[2].content.indexOf('_book/assets/my-pretty-picture.png') !== -1); + }) + it('should gen code and content for exercise sections', function() { assert(LEXED[1].content); assert(LEXED[1].code); @@ -67,7 +74,7 @@ describe('Relative links', function() { repo: 'GitBookIO/javascript', // Imaginary folder of markdown file - dir: 'course', + dir: 'course' }); assert(LEXED[0].content.indexOf('https://github.com/GitBookIO/javascript/blob/src/something.cpp') !== -1); |