diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-21 12:05:31 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-21 12:05:31 +0100 |
commit | 51fd8ae08c1616b6826e72dd86e658f4e921bed9 (patch) | |
tree | 2482d497f2873db429ba8f6bdc3ab0e2b8d234ac /test/summary.js | |
parent | 884540e56530b8e1c68c94604c0b45f0489d5020 (diff) | |
download | gitbook-51fd8ae08c1616b6826e72dd86e658f4e921bed9.zip gitbook-51fd8ae08c1616b6826e72dd86e658f4e921bed9.tar.gz gitbook-51fd8ae08c1616b6826e72dd86e658f4e921bed9.tar.bz2 |
Simplify .next and .prev for articles
Diffstat (limited to 'test/summary.js')
-rw-r--r-- | test/summary.js | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/test/summary.js b/test/summary.js index f7a975f..68c23b4 100644 --- a/test/summary.js +++ b/test/summary.js @@ -126,7 +126,10 @@ describe('Summary / Table of contents', function() { '* [Hello 6](hello6.md)\n\n\n' + '### Part 2\n\n' + '* [Hello 7](hello7.md)\n' + - '* [Hello 8](hello8.md)\n\n' + ' * [Hello 8](hello8.md)\n\n' + + '### Part 3\n\n' + + '* [Hello 9](hello9.md)\n' + + '* [Hello 10](hello10.md)\n\n' }) .then(function(_book) { book = _book; @@ -210,6 +213,19 @@ describe('Summary / Table of contents', function() { next.path.should.equal('hello6.md'); }); + it('should return next/prev for a joint -> parts', function() { + var article = book.summary.getArticle('hello6.md'); + + var prev = article.prev(); + var next = article.next(); + + should(prev).be.ok(); + should(next).be.ok(); + + prev.path.should.equal('hello5.md'); + next.path.should.equal('hello7.md'); + }); + it('should return next/prev for a joint <- parts', function() { var article = book.summary.getArticle('hello7.md'); @@ -223,8 +239,8 @@ describe('Summary / Table of contents', function() { next.path.should.equal('hello8.md'); }); - it('should return next/prev for a joint -> parts', function() { - var article = book.summary.getArticle('hello6.md'); + it('should return next and prev', function() { + var article = book.summary.getArticle('hello8.md'); var prev = article.prev(); var next = article.next(); @@ -232,12 +248,12 @@ describe('Summary / Table of contents', function() { should(prev).be.ok(); should(next).be.ok(); - prev.path.should.equal('hello5.md'); - next.path.should.equal('hello7.md'); + prev.path.should.equal('hello7.md'); + next.path.should.equal('hello9.md'); }); it('should return only prev for last', function() { - var article = book.summary.getArticle('hello8.md'); + var article = book.summary.getArticle('hello10.md'); var prev = article.prev(); var next = article.next(); @@ -245,7 +261,7 @@ describe('Summary / Table of contents', function() { should(prev).be.ok(); should(next).be.not.ok(); - prev.path.should.equal('hello7.md'); + prev.path.should.equal('hello9.md'); }); }); }); |