summaryrefslogtreecommitdiffstats
path: root/test/page.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-15 09:55:12 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-15 09:55:12 +0100
commit1b19c6660303cb6ce98ac0ad76580f66b52985f1 (patch)
tree2e7df114dfe057e644667b1c719fb03b1eddfa20 /test/page.js
parentd7077fc7db130d91f117dbf7ef01ec6ff5c6fb8e (diff)
downloadgitbook-1b19c6660303cb6ce98ac0ad76580f66b52985f1.zip
gitbook-1b19c6660303cb6ce98ac0ad76580f66b52985f1.tar.gz
gitbook-1b19c6660303cb6ce98ac0ad76580f66b52985f1.tar.bz2
Complete page.previous and page.next variables
Diffstat (limited to 'test/page.js')
-rw-r--r--test/page.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/page.js b/test/page.js
index a9b7985..fb3e3e5 100644
--- a/test/page.js
+++ b/test/page.js
@@ -11,11 +11,21 @@ describe('Page', function() {
'folder/paths.md': '',
'variables/file/mtime.md': '{{ file.mtime }}',
'variables/file/path.md': '{{ file.path }}',
- 'variables/page/title.md': '{{ page.title }}'
+ 'variables/page/title.md': '{{ page.title }}',
+ 'variables/page/previous.md': '{{ page.previous.title }} {{ page.previous.path }}',
+ 'variables/page/next.md': '{{ page.next.title }} {{ page.next.path }}'
}, [
{
+ title: 'Test page.next',
+ path: 'variables/page/next.md'
+ },
+ {
title: 'Test Variables',
path: 'variables/page/title.md'
+ },
+ {
+ title: 'Test page.previous',
+ path: 'variables/page/previous.md'
}
])
.then(function(_book) {
@@ -121,5 +131,17 @@ describe('Page', function() {
return page.toHTML(output)
.should.be.fulfilledWith('<p>Test Variables</p>\n');
});
+
+ it('should set page.previous when possible', function() {
+ var page = book.getPage('variables/page/previous.md');
+ return page.toHTML(output)
+ .should.be.fulfilledWith('<p>Test Variables variables/page/title.md</p>\n');
+ });
+
+ it('should set page.next when possible', function() {
+ var page = book.getPage('variables/page/next.md');
+ return page.toHTML(output)
+ .should.be.fulfilledWith('<p>Test Variables variables/page/title.md</p>\n');
+ });
});
});