summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-28 18:23:48 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-28 18:23:48 +0100
commitc0d922560daa53ad31f356480e6fbe3f2191f471 (patch)
tree8f4f783fae262b318505208e8d2ff4ab51007783 /test
parentf5ded5e5e1cccacd9288f8888943a105b6b3aaa5 (diff)
downloadgitbook-c0d922560daa53ad31f356480e6fbe3f2191f471.zip
gitbook-c0d922560daa53ad31f356480e6fbe3f2191f471.tar.gz
gitbook-c0d922560daa53ad31f356480e6fbe3f2191f471.tar.bz2
Improve svg conversion and links normalization
Diffstat (limited to 'test')
-rw-r--r--test/ebook.js10
-rw-r--r--test/fixtures/test4/PAGE.md5
-rw-r--r--test/fixtures/test4/SUMMARY.md2
-rw-r--r--test/fixtures/test4/sub/PAGE.md5
4 files changed, 15 insertions, 7 deletions
diff --git a/test/ebook.js b/test/ebook.js
index 05a2000..6facd8b 100644
--- a/test/ebook.js
+++ b/test/ebook.js
@@ -15,9 +15,17 @@ describe('eBook Generator', function () {
it('should correctly convert svg images to png', function(done) {
testGeneration(books[4], "ebook", function(output) {
+ var pageContent = fs.readFileSync(path.join(output, "sub/PAGE.html"), {encoding: "utf8"});
+
assert(fs.existsSync(path.join(output, "test.png")));
- assert(!fs.existsSync(path.join(output, "test_0.png")));
assert(fs.existsSync(path.join(output, "NewTux.png")));
+
+ assert(!fs.existsSync(path.join(output, "test_0.png")));
+ assert(!fs.existsSync(path.join(output, "sub/test.png")));
+ assert(!fs.existsSync(path.join(output, "sub/NewTux.png")));
+
+ assert(pageContent.indexOf('src="../test.png"') >= 0);
+ assert(pageContent.indexOf('src="../NewTux.png"') >= 0);
}, done);
});
});
diff --git a/test/fixtures/test4/PAGE.md b/test/fixtures/test4/PAGE.md
deleted file mode 100644
index 0320232..0000000
--- a/test/fixtures/test4/PAGE.md
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-![test image to be converted](./test.svg)
-![test url](http://upload.wikimedia.org/wikipedia/commons/b/b0/NewTux.svg)
-![test image to be converted, second use](./test.svg)
diff --git a/test/fixtures/test4/SUMMARY.md b/test/fixtures/test4/SUMMARY.md
index 44a33de..3cda114 100644
--- a/test/fixtures/test4/SUMMARY.md
+++ b/test/fixtures/test4/SUMMARY.md
@@ -1,3 +1,3 @@
# Summary
-* [Page](PAGE.md)
+* [Page](sub/PAGE.md)
diff --git a/test/fixtures/test4/sub/PAGE.md b/test/fixtures/test4/sub/PAGE.md
new file mode 100644
index 0000000..094da59
--- /dev/null
+++ b/test/fixtures/test4/sub/PAGE.md
@@ -0,0 +1,5 @@
+
+
+![test image to be converted](../test.svg)
+![test url](http://upload.wikimedia.org/wikipedia/commons/b/b0/NewTux.svg)
+![test image to be converted, second use](../test.svg)