diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-20 17:26:13 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-20 17:26:13 +0200 |
commit | 09ff802c7ed99ce269f464baa777ece483067969 (patch) | |
tree | b52f40652e7cfb0edcb5ec0db2f1cf9daa2b2445 /test/structure.js | |
parent | a3300ad9c63c12faf9049234dff0b515edb3a870 (diff) | |
download | gitbook-09ff802c7ed99ce269f464baa777ece483067969.zip gitbook-09ff802c7ed99ce269f464baa777ece483067969.tar.gz gitbook-09ff802c7ed99ce269f464baa777ece483067969.tar.bz2 |
When using structure.readme, fix link to readme to resolve to index.html
Diffstat (limited to 'test/structure.js')
-rw-r--r-- | test/structure.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/structure.js b/test/structure.js new file mode 100644 index 0000000..0d043fe --- /dev/null +++ b/test/structure.js @@ -0,0 +1,51 @@ +var fs = require('fs'); + +var mock = require('./mock'); +var WebsiteOutput = require('../lib/output/website'); + +/* + + Testing using configuration "structure" to use custom Readme/Summary/Glossary paths +*/ + +describe('Structure', function() { + var output; + + before(function() { + return mock.outputBook(WebsiteOutput, { + 'book.json': { + structure: { + readme: 'intro.md' + } + }, + 'SUMMARY.md': '* [Test](test.md)', + 'intro.md': 'This is the intro', + 'test.md': 'Go to [intro](intro.md)' + }) + .then(function(_output) { + output = _output; + }); + }); + + it('should generate index.html', function() { + output.should.have.file('index.html'); + }); + + it('should generate test.html', function() { + output.should.have.file('test.html'); + }); + + it('should correctly resolve link to Readme', function() { + var readme = fs.readFileSync(output.resolve('test.html'), 'utf-8'); + + readme.should.be.html({ + '.page-inner a': { + count: 1, + text: 'intro', + attributes: { + href: './' + } + } + }); + }); +}); |