summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-html/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-html/test')
-rwxr-xr-xpackages/gitbook-html/test/fixtures/SUMMARY.html2
-rwxr-xr-xpackages/gitbook-html/test/summary.js16
2 files changed, 16 insertions, 2 deletions
diff --git a/packages/gitbook-html/test/fixtures/SUMMARY.html b/packages/gitbook-html/test/fixtures/SUMMARY.html
index bae97f3..ec95da7 100755
--- a/packages/gitbook-html/test/fixtures/SUMMARY.html
+++ b/packages/gitbook-html/test/fixtures/SUMMARY.html
@@ -25,6 +25,8 @@
<li>Unfinished Chapter</li>
</ul>
+<h2>Part 2</h2>
+
<ul>
<li>
<a href="chapter-1/README.md">Chapter 1</a>
diff --git a/packages/gitbook-html/test/summary.js b/packages/gitbook-html/test/summary.js
index 4d06c32..02104cd 100755
--- a/packages/gitbook-html/test/summary.js
+++ b/packages/gitbook-html/test/summary.js
@@ -13,14 +13,26 @@ describe('Summary parsing', function () {
PART = LEXED.parts[0];
});
- it('should detect parts', function() {
- assert.equal(LEXED.parts.length, 3);
+ describe('Parts', function() {
+ it('should detect parts', function() {
+ assert.equal(LEXED.parts.length, 3);
+ });
+
+ it('should detect title', function() {
+ assert.equal(LEXED.parts[0].title, '');
+ assert.equal(LEXED.parts[1].title, 'Part 2');
+ assert.equal(LEXED.parts[2].title, '');
+ });
});
it('should detect chapters', function() {
assert.equal(PART.articles.length, 5);
});
+ it('should detect chapters in other parts', function() {
+ assert.equal(LEXED.parts[1].articles.length, 1);
+ });
+
it('should support articles', function() {
assert.equal(PART.articles[0].articles.length, 2);
assert.equal(PART.articles[1].articles.length, 0);