diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-21 17:23:07 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-21 17:23:07 +0100 |
commit | a9c96c1afa8c9322645d25684d4171ba540a4d8f (patch) | |
tree | 06be18198e015291fa2ba29f69db843889ea21b6 /test/assets-inliner.js | |
parent | a446deaff32714c81fb02c7138de48fafa8216c8 (diff) | |
download | gitbook-a9c96c1afa8c9322645d25684d4171ba540a4d8f.zip gitbook-a9c96c1afa8c9322645d25684d4171ba540a4d8f.tar.gz gitbook-a9c96c1afa8c9322645d25684d4171ba540a4d8f.tar.bz2 |
Fix resolve of relatives images in assets inliner
Diffstat (limited to 'test/assets-inliner.js')
-rw-r--r-- | test/assets-inliner.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/assets-inliner.js b/test/assets-inliner.js index 498d3cb..7ccabc5 100644 --- a/test/assets-inliner.js +++ b/test/assets-inliner.js @@ -13,12 +13,15 @@ describe('Assets Inliner Output', function() { return mock.outputDefaultBook(AssetsInliner, { 'README.md': '', - // test for SVGS + // SVGs 'svg_file.md': '', 'svg_inline.md': 'This is a svg: '+SVG, 'test.svg': '<?xml version="1.0" encoding="UTF-8"?>' + SVG, - // test for remote files + // Relative + 'folder/test.md': '', + + // Remote images 'remote_png.md': '', 'remote_svg.md': '', @@ -26,6 +29,7 @@ describe('Assets Inliner Output', function() { '* [svg file](svg_file.md)\n' + '* [remote png file](remote_png.md)\n' + '* [remote svg file](remote_svg.md)\n' + + '* [relative image](folder/test.md)\n' + '\n\n' }) .then(function(_output) { @@ -43,8 +47,14 @@ describe('Assets Inliner Output', function() { // Does the file exists var src = $img.attr('src'); + + // Resolve the filename + src = page.resolveLocal(src); + output.should.have.file(src); path.extname(src).should.equal('.png'); + + return src; } describe('SVG', function() { @@ -66,5 +76,11 @@ describe('Assets Inliner Output', function() { testImageInPage('remote_svg.md'); }); }); + + describe('Relative Images', function() { + it('should correctly resolve image', function() { + testImageInPage('folder/test.md'); + }); + }); }); |