diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-18 17:23:33 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-18 17:23:33 +0200 |
commit | dd0579b60d29da744ef49aae26423b91529ac8cd (patch) | |
tree | 412964c37313a7660be740704eb027e70ea608bd /test/page.js | |
parent | b5bb953e4779a591ade83356ffbf776047c53f5b (diff) | |
download | gitbook-dd0579b60d29da744ef49aae26423b91529ac8cd.zip gitbook-dd0579b60d29da744ef49aae26423b91529ac8cd.tar.gz gitbook-dd0579b60d29da744ef49aae26423b91529ac8cd.tar.bz2 |
Update tests for relative images
Diffstat (limited to 'test/page.js')
-rw-r--r-- | test/page.js | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/test/page.js b/test/page.js index 52a3df6..fb6fd70 100644 --- a/test/page.js +++ b/test/page.js @@ -36,10 +36,6 @@ 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); @@ -94,3 +90,33 @@ describe('Relative links', function() { assert(LEXED[0].content.indexOf('https://github.com/GitBookIO/javascript/blob/src/something.cpp') !== -1); }); }); + +describe('Relative images', function() { + it('should keep image relative with considering output directory in site format', function() { + var LEXED = loadPage('IMAGES', { + // GitHub repo ID + repo: 'GitBookIO/javascript', + + // Imaginary folder of markdown file + dir: 'syntax', + outdir: 'syntax' + }); + + assert(LEXED[0].content.indexOf('"preview.png"') !== -1); + assert(LEXED[0].content.indexOf('"../preview2.png"') !== -1); + }); + + it('should keep image relative with considering output directory in page format', function() { + var LEXED = loadPage('IMAGES', { + // GitHub repo ID + repo: 'GitBookIO/javascript', + + // Imaginary folder of markdown file + dir: 'syntax', + outdir: './' + }); + + assert(LEXED[0].content.indexOf('"syntax/preview.png"') !== -1); + assert(LEXED[0].content.indexOf('"preview2.png"') !== -1); + }); +}); |