summaryrefslogtreecommitdiffstats
path: root/lib/output/modifiers/__tests__/resolveLinks.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-05-25 21:49:58 +0200
committerSamy Pesse <samypesse@gmail.com>2016-05-25 21:49:58 +0200
commit089815a8fd31fff5cfcc10b392d0f64bb1598f48 (patch)
tree2ad1844dd2734671de3aa5ae8246ac9816dd1504 /lib/output/modifiers/__tests__/resolveLinks.js
parent7e8f1a9632f3c5b9428f347ba9db5b4ff590e814 (diff)
downloadgitbook-089815a8fd31fff5cfcc10b392d0f64bb1598f48.zip
gitbook-089815a8fd31fff5cfcc10b392d0f64bb1598f48.tar.gz
gitbook-089815a8fd31fff5cfcc10b392d0f64bb1598f48.tar.bz2
Fix #1328: fix crash when anchor links
Diffstat (limited to 'lib/output/modifiers/__tests__/resolveLinks.js')
-rw-r--r--lib/output/modifiers/__tests__/resolveLinks.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/output/modifiers/__tests__/resolveLinks.js b/lib/output/modifiers/__tests__/resolveLinks.js
index e42b619..c57346a 100644
--- a/lib/output/modifiers/__tests__/resolveLinks.js
+++ b/lib/output/modifiers/__tests__/resolveLinks.js
@@ -40,9 +40,8 @@ describe('resolveLinks', function() {
});
describe('Anchor', function() {
- var TEST = '<p>This is a <a href="test/cool.md#an-anchor"></a></p>';
-
it('should prevent anchors in resolution', function() {
+ var TEST = '<p>This is a <a href="test/cool.md#an-anchor"></a></p>';
var $ = cheerio.load(TEST);
return resolveLinks('hello.md', resolveFileCustom, $)
@@ -51,6 +50,17 @@ describe('resolveLinks', function() {
expect(link.attr('href')).toBe('test/cool.html#an-anchor');
});
});
+
+ it('should ignore pure anchor links', function() {
+ var TEST = '<p>This is a <a href="#an-anchor"></a></p>';
+ var $ = cheerio.load(TEST);
+
+ return resolveLinks('hello.md', resolveFileCustom, $)
+ .then(function() {
+ var link = $('a');
+ expect(link.attr('href')).toBe('#an-anchor');
+ });
+ });
});
describe('Custom Resolver', function() {