diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-02-12 23:57:43 +0100 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-02-12 23:57:43 +0100 |
commit | 4c6717e23488656686f276aa2b40ce1d1c7641f8 (patch) | |
tree | c728f106224cedc836b83b06609011990eac4f5a /test/page.js | |
parent | 39b6562d1445e9a6c43a377d2a978eefa6458755 (diff) | |
download | gitbook-4c6717e23488656686f276aa2b40ce1d1c7641f8.zip gitbook-4c6717e23488656686f276aa2b40ce1d1c7641f8.tar.gz gitbook-4c6717e23488656686f276aa2b40ce1d1c7641f8.tar.bz2 |
Add conversion of svg to png for assets inliner
Diffstat (limited to 'test/page.js')
-rw-r--r-- | test/page.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/page.js b/test/page.js index 01c6466..9007c45 100644 --- a/test/page.js +++ b/test/page.js @@ -7,7 +7,8 @@ describe('Page', function() { before(function() { return mock.setupDefaultBook({ 'heading.md': '# Hello\n\n## World', - 'links.md': '[link](hello.md) [readme](README.md)' + 'links.md': '[link](hello.md) [readme](README.md)', + 'folder/paths.md': '' }) .then(function(_book) { book = _book; @@ -17,6 +18,26 @@ describe('Page', function() { }); }); + describe('.resolveLocal', function() { + it('should correctly resolve path to file', function() { + var page = book.addPage('heading.md'); + + page.resolveLocal('test.png').should.equal('test.png'); + page.resolveLocal('/test.png').should.equal('test.png'); + page.resolveLocal('test/hello.png').should.equal('test/hello.png'); + page.resolveLocal('/test/hello.png').should.equal('test/hello.png'); + }); + + it('should correctly resolve path to file (2)', function() { + var page = book.addPage('folder/paths.md'); + + page.resolveLocal('test.png').should.equal('folder/test.png'); + page.resolveLocal('/test.png').should.equal('test.png'); + page.resolveLocal('test/hello.png').should.equal('folder/test/hello.png'); + page.resolveLocal('/test/hello.png').should.equal('test/hello.png'); + }); + }); + describe('Headings', function() { it('should add a default ID to headings', function() { var page = book.addPage('heading.md'); |