diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-25 15:43:55 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-25 15:43:55 +0100 |
commit | 327e90e8ec731352d659aa0ada810332fcd66a18 (patch) | |
tree | 2acdb2e1f7c42d91ff098b5cabfa4e57701756bc /test | |
parent | 9253b764fad8452fb1cf0760be482b692fdfb728 (diff) | |
download | gitbook-327e90e8ec731352d659aa0ada810332fcd66a18.zip gitbook-327e90e8ec731352d659aa0ada810332fcd66a18.tar.gz gitbook-327e90e8ec731352d659aa0ada810332fcd66a18.tar.bz2 |
Extract description from page's front matter
Fixes #1079 and #795
Diffstat (limited to 'test')
-rw-r--r-- | test/page.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/page.js b/test/page.js index f11d55e..ae36660 100644 --- a/test/page.js +++ b/test/page.js @@ -8,6 +8,8 @@ describe('Page', function() { return mock.setupDefaultBook({ 'README.md': ' # Hello World\n\nThis is a description', 'heading.md': '# Hello\n\n## World', + 'description.md': '# This is a title\n\nThis is the short description.\n\nNot this one.', + 'frontmatter.md': '---\ndescription: Hello World\n---\n\n# This is a title\n\nThis is not the description', 'links.md': '[link](hello.md) [link 2](variables/page/next.md) [readme](README.md)', 'links/relative.md': '[link](../hello.md) [link 2](/variables/page/next.md) [readme](../README.md)', @@ -128,6 +130,28 @@ describe('Page', function() { }); }); + describe('Description', function() { + it('should extratc page description from content', function() { + var page = book.addPage('description.md'); + + return page.toHTML(output) + .then(function() { + page.description.should.equal('This is the short description.'); + }); + }); + }); + + describe('Font-Matter', function() { + it('should extratc page description from front matter', function() { + var page = book.addPage('frontmatter.md'); + + return page.toHTML(output) + .then(function() { + page.description.should.equal('Hello World'); + }); + }); + }); + describe('Code Blocks', function() { var page; |