diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-21 11:56:14 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-21 11:56:14 +0100 |
commit | 884540e56530b8e1c68c94604c0b45f0489d5020 (patch) | |
tree | 13f58c99828c1745497e889b516795a99562803a /test | |
parent | ca1313e891f7cfbdffaf6a47bb75a8bc1d77c1a4 (diff) | |
download | gitbook-884540e56530b8e1c68c94604c0b45f0489d5020.zip gitbook-884540e56530b8e1c68c94604c0b45f0489d5020.tar.gz gitbook-884540e56530b8e1c68c94604c0b45f0489d5020.tar.bz2 |
Fix .next and .prev for summary's articles to use parts
Diffstat (limited to 'test')
-rw-r--r-- | test/summary.js | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/test/summary.js b/test/summary.js index 8805c2d..f7a975f 100644 --- a/test/summary.js +++ b/test/summary.js @@ -123,7 +123,10 @@ describe('Summary / Table of contents', function() { ' * [Hello 3](hello3.md)\n' + ' * [Hello 4](hello4.md)\n' + ' * [Hello 5](hello5.md)\n' + - '* [Hello 6](hello6.md)\n' + '* [Hello 6](hello6.md)\n\n\n' + + '### Part 2\n\n' + + '* [Hello 7](hello7.md)\n' + + '* [Hello 8](hello8.md)\n\n' }) .then(function(_book) { book = _book; @@ -136,7 +139,7 @@ describe('Summary / Table of contents', function() { var prev = article.prev(); var next = article.next(); - should(prev).equal(null); + should(prev).not.be.ok(); should(next).be.ok(); next.path.should.equal('hello.md'); @@ -207,16 +210,42 @@ describe('Summary / Table of contents', function() { next.path.should.equal('hello6.md'); }); - it('should return prev for last', function() { + it('should return next/prev for a joint <- parts', function() { + var article = book.summary.getArticle('hello7.md'); + + var prev = article.prev(); + var next = article.next(); + + should(prev).be.ok(); + should(next).be.ok(); + + prev.path.should.equal('hello6.md'); + next.path.should.equal('hello8.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.not.ok(); + should(next).be.ok(); prev.path.should.equal('hello5.md'); + next.path.should.equal('hello7.md'); + }); + + it('should return only prev for last', function() { + var article = book.summary.getArticle('hello8.md'); + + var prev = article.prev(); + var next = article.next(); + + should(prev).be.ok(); + should(next).be.not.ok(); + + prev.path.should.equal('hello7.md'); }); }); }); |