summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-02-07 20:35:24 +0100
committerSamy Pessé <samypesse@gmail.com>2015-02-07 20:35:24 +0100
commit370799ac555676bbef44fe27a569307b7e0d5232 (patch)
tree5a1c1d76c0dddd8947f8e167979309b442a8c59a
parent4a9adb9440b21356cd7b45887088f63230131818 (diff)
downloadgitbook-370799ac555676bbef44fe27a569307b7e0d5232.zip
gitbook-370799ac555676bbef44fe27a569307b7e0d5232.tar.gz
gitbook-370799ac555676bbef44fe27a569307b7e0d5232.tar.bz2
Add test for #595: glossary links in subpages
-rw-r--r--test/fixtures/test1/sub/test1.md2
-rw-r--r--test/glossary.js12
2 files changed, 14 insertions, 0 deletions
diff --git a/test/fixtures/test1/sub/test1.md b/test/fixtures/test1/sub/test1.md
index 6a6e788..d45a4dd 100644
--- a/test/fixtures/test1/sub/test1.md
+++ b/test/fixtures/test1/sub/test1.md
@@ -4,3 +4,5 @@ This is a relative link [test](../intro.md).
![image](../image.png)
+This is a glossary link.
+
diff --git a/test/glossary.js b/test/glossary.js
index 442f857..da2cbb1 100644
--- a/test/glossary.js
+++ b/test/glossary.js
@@ -19,4 +19,16 @@ describe('Glossary Generation', function () {
assert($a.text() == "description");
}, done);
});
+
+ it('should correctly replace glossary terms in sub pages', function(done) {
+ testGeneration(books[1], "website", function(output) {
+ var content = fs.readFileSync(path.join(output, "sub/test1.html"), { encoding: "utf8" });
+ var $ = cheerio.load(content);
+
+ var $body = $(".page-inner");
+ var $a = $("a[href='../GLOSSARY.html#test']");
+ assert($a.length == 1);
+ assert($a.text() == "a test text");
+ }, done);
+ });
});