summaryrefslogtreecommitdiffstats
path: root/test/page.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-04-22 17:45:12 +0200
committerSamy Pessé <samypesse@gmail.com>2014-04-22 17:45:12 +0200
commit305f2210773c6f6e798d2443a28de95cc8b7bfb2 (patch)
tree632921a4696471b112eda54f6050091e3bbc09f6 /test/page.js
parent53514f2602029d61106e1214790fddf072bf9a81 (diff)
downloadgitbook-305f2210773c6f6e798d2443a28de95cc8b7bfb2.zip
gitbook-305f2210773c6f6e798d2443a28de95cc8b7bfb2.tar.gz
gitbook-305f2210773c6f6e798d2443a28de95cc8b7bfb2.tar.bz2
Fix #136: replace links to .md by links to .html
Add more tests for links in page
Diffstat (limited to 'test/page.js')
-rw-r--r--test/page.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/page.js b/test/page.js
index fb6fd70..36d521a 100644
--- a/test/page.js
+++ b/test/page.js
@@ -84,11 +84,41 @@ describe('Relative links', function() {
repo: 'GitBookIO/javascript',
// Imaginary folder of markdown file
- dir: 'course'
+ dir: 'course',
+ outdir: './'
});
assert(LEXED[0].content.indexOf('https://github.com/GitBookIO/javascript/blob/src/something.cpp') !== -1);
});
+
+ it('should replace link to .md by link to .html', function() {
+ var LEXED = loadPage('MARKDOWN_LINKS', {
+ // GitHub repo ID
+ repo: 'GitBookIO/javascript',
+
+ // Imaginary folder of markdown file
+ dir: 'course',
+ outdir: 'course'
+ });
+
+ assert(LEXED[0].content.indexOf('test.html') !== -1);
+ assert(LEXED[0].content.indexOf('../before.html') !== -1);
+ });
+
+ it('should replace link to .md by link to page in format single page', function() {
+ var LEXED = loadPage('MARKDOWN_LINKS', {
+ // GitHub repo ID
+ repo: 'GitBookIO/javascript',
+
+ // Imaginary folder of markdown file
+ dir: 'course',
+ outdir: './',
+ singleFile: true
+ });
+
+ assert(LEXED[0].content.indexOf('#course/test.md') !== -1);
+ assert(LEXED[0].content.indexOf('#before.md') !== -1);
+ });
});
describe('Relative images', function() {