summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2014-05-26 11:27:27 -0700
committerAaron O'Mullan <aaron.omullan@gmail.com>2014-05-26 11:27:27 -0700
commit115fba837c45fef5b3e203b633cc198dcb77ff5f (patch)
treea9fd1fdfa96238da0d645d0b8589d22425fe6656 /test
parent4df51546b2bd29a2dd3a5b11eeca80a157f6ffb1 (diff)
parenta0d56460343937451326237107944941b16cdbb9 (diff)
downloadgitbook-115fba837c45fef5b3e203b633cc198dcb77ff5f.zip
gitbook-115fba837c45fef5b3e203b633cc198dcb77ff5f.tar.gz
gitbook-115fba837c45fef5b3e203b633cc198dcb77ff5f.tar.bz2
Merge pull request #265 from GitbookIO/feature/levels
More than two section level in summary
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/SUMMARY.md2
-rw-r--r--test/navigation.js14
-rw-r--r--test/summary.js1
3 files changed, 15 insertions, 2 deletions
diff --git a/test/fixtures/SUMMARY.md b/test/fixtures/SUMMARY.md
index 74bbd1b..8418f1e 100644
--- a/test/fixtures/SUMMARY.md
+++ b/test/fixtures/SUMMARY.md
@@ -3,6 +3,8 @@
* [Chapter 1](chapter-1/README.md)
* [Article 1](chapter-1/ARTICLE1.md)
* [Article 2](chapter-1/ARTICLE2.md)
+ * [article 1.2.1](chapter-1/ARTICLE-1-2-1.md)
+ * [article 1.2.2](chapter-1/ARTICLE-1-2-2.md)
* [Chapter 2](chapter-2/README.md)
* [Chapter 3](chapter-3/README.md)
* [Chapter 4](chapter-4/README.md)
diff --git a/test/navigation.js b/test/navigation.js
index b0e5b98..0330d74 100644
--- a/test/navigation.js
+++ b/test/navigation.js
@@ -18,6 +18,8 @@ describe('Summary navigation', function() {
'chapter-1/ARTICLE1.md',
'chapter-1/ARTICLE2.md',
'chapter-2/README.md',
+ 'chapter-1/ARTICLE-1-2-1.md',
+ 'chapter-1/ARTICLE-1-2-2.md'
]);
// Make sure it found the files we gave it
@@ -26,6 +28,8 @@ describe('Summary navigation', function() {
assert(nav['chapter-1/ARTICLE1.md']);
assert(nav['chapter-1/ARTICLE2.md']);
assert(nav['chapter-2/README.md']);
+ assert(nav['chapter-1/ARTICLE-1-2-1.md']);
+ assert(nav['chapter-1/ARTICLE-1-2-2.md']);
assert.equal(nav['README.md'].prev, null);
@@ -38,9 +42,15 @@ describe('Summary navigation', function() {
assert.equal(nav['chapter-1/ARTICLE1.md'].next.path, 'chapter-1/ARTICLE2.md');
assert.equal(nav['chapter-1/ARTICLE2.md'].prev.path, 'chapter-1/ARTICLE1.md');
- assert.equal(nav['chapter-1/ARTICLE2.md'].next.path, 'chapter-2/README.md');
+ assert.equal(nav['chapter-1/ARTICLE2.md'].next.path, 'chapter-1/ARTICLE-1-2-1.md');
- assert.equal(nav['chapter-2/README.md'].prev.path, 'chapter-1/ARTICLE2.md');
+ assert.equal(nav['chapter-1/ARTICLE-1-2-1.md'].prev.path, 'chapter-1/ARTICLE2.md');
+ assert.equal(nav['chapter-1/ARTICLE-1-2-1.md'].next.path, 'chapter-1/ARTICLE-1-2-2.md');
+
+ assert.equal(nav['chapter-1/ARTICLE-1-2-2.md'].prev.path, 'chapter-1/ARTICLE-1-2-1.md');
+ assert.equal(nav['chapter-1/ARTICLE-1-2-2.md'].next.path, 'chapter-2/README.md');
+
+ assert.equal(nav['chapter-2/README.md'].prev.path, 'chapter-1/ARTICLE-1-2-2.md');
assert.equal(nav['chapter-2/README.md'].next.path, 'chapter-3/README.md');
});
diff --git a/test/summary.js b/test/summary.js
index 9af1f9f..0316b31 100644
--- a/test/summary.js
+++ b/test/summary.js
@@ -50,5 +50,6 @@ describe('Summary parsing', function () {
assert.equal(c[0].articles[0].level, '1.1');
assert.equal(c[0].articles[1].level, '1.2');
+ assert.equal(c[0].articles[1].articles[0].level, '1.2.1');
});
});