diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-15 09:44:05 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-15 09:44:05 +0100 |
commit | d7077fc7db130d91f117dbf7ef01ec6ff5c6fb8e (patch) | |
tree | 83d8f8439595c7ff481adf7dbaeb5ca7c23bd45c /test/page.js | |
parent | d6bd4a0d67dd2f61e667aefebf96e279f607ce54 (diff) | |
download | gitbook-d7077fc7db130d91f117dbf7ef01ec6ff5c6fb8e.zip gitbook-d7077fc7db130d91f117dbf7ef01ec6ff5c6fb8e.tar.gz gitbook-d7077fc7db130d91f117dbf7ef01ec6ff5c6fb8e.tar.bz2 |
Add test for page.title variable
Diffstat (limited to 'test/page.js')
-rw-r--r-- | test/page.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/test/page.js b/test/page.js index 9932e38..a9b7985 100644 --- a/test/page.js +++ b/test/page.js @@ -10,8 +10,14 @@ describe('Page', function() { 'links.md': '[link](hello.md) [readme](README.md)', 'folder/paths.md': '', 'variables/file/mtime.md': '{{ file.mtime }}', - 'variables/file/path.md': '{{ file.path }}' - }) + 'variables/file/path.md': '{{ file.path }}', + 'variables/page/title.md': '{{ page.title }}' + }, [ + { + title: 'Test Variables', + path: 'variables/page/title.md' + } + ]) .then(function(_book) { book = _book; output = new Output(book); @@ -95,7 +101,6 @@ describe('Page', function() { }); }); - describe('Templating Context', function() { it('should set file.mtime', function() { var page = book.addPage('variables/file/mtime.md'); @@ -105,10 +110,16 @@ describe('Page', function() { }); }); - it('should set file.[path]', function() { + it('should set file.path', function() { var page = book.addPage('variables/file/path.md'); return page.toHTML(output) .should.be.fulfilledWith('<p>variables/file/path.md</p>\n'); }); + + it('should set page.title when page is in summary', function() { + var page = book.getPage('variables/page/title.md'); + return page.toHTML(output) + .should.be.fulfilledWith('<p>Test Variables</p>\n'); + }); }); -});
\ No newline at end of file +}); |