diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-03-02 11:11:39 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-03-02 11:11:39 +0100 |
commit | 21d696423068082adb79b85917719ea18562e4d2 (patch) | |
tree | 88c8db7120c91d1909441763a20663de3ce8f1ff /test/page.js | |
parent | 4499ccc501950f472ade2175e742d707752ef39d (diff) | |
download | gitbook-21d696423068082adb79b85917719ea18562e4d2.zip gitbook-21d696423068082adb79b85917719ea18562e4d2.tar.gz gitbook-21d696423068082adb79b85917719ea18562e4d2.tar.bz2 |
Extend "page" with frontmatter attributes
Diffstat (limited to 'test/page.js')
-rw-r--r-- | test/page.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/page.js b/test/page.js index ae36660..1dd00ba 100644 --- a/test/page.js +++ b/test/page.js @@ -9,7 +9,8 @@ describe('Page', function() { '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', + 'frontmatter/description.md': '---\ndescription: Hello World\n---\n\n# This is a title\n\nThis is not the description', + 'frontmatter/var.md': '---\ntest: Hello World\n---\n\n{{ page.test }}', '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)', @@ -142,14 +143,23 @@ describe('Page', function() { }); describe('Font-Matter', function() { - it('should extratc page description from front matter', function() { - var page = book.addPage('frontmatter.md'); + it('should extract page description from front matter', function() { + var page = book.addPage('frontmatter/description.md'); return page.toHTML(output) .then(function() { page.description.should.equal('Hello World'); }); }); + + it('should extend page attributes with custom properties', function() { + var page = book.addPage('frontmatter/var.md'); + + return page.toHTML(output) + .then(function() { + page.content.should.equal('<p>Hello World</p>\n'); + }); + }); }); describe('Code Blocks', function() { |