summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-03-06 10:25:06 +0100
committerSamy Pessé <samypesse@gmail.com>2015-03-06 10:25:06 +0100
commit145b00f590944cc60812be90560721ebeb7eecda (patch)
tree634daace664bbc98517cf1ab7cfd9bc711fc4f88 /test
parent5f2785f0a8a6a752a7de8a7c6332574ada4875aa (diff)
downloadgitbook-145b00f590944cc60812be90560721ebeb7eecda.zip
gitbook-145b00f590944cc60812be90560721ebeb7eecda.tar.gz
gitbook-145b00f590944cc60812be90560721ebeb7eecda.tar.bz2
Fix #628: preserve pure anchor links and hash in relative links
Diffstat (limited to 'test')
-rw-r--r--test/links.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/links.js b/test/links.js
index 4dad4d4..2c68a23 100644
--- a/test/links.js
+++ b/test/links.js
@@ -13,6 +13,13 @@ describe('Links', function () {
assert(!links.isExternal("/folder/test.md"));
});
+ it('should correctly test anchor links', function() {
+ assert(links.isAnchor("#test"));
+ assert(links.isAnchor(" #test"));
+ assert(!links.isAnchor("https://google.fr#test"));
+ assert(!links.isAnchor("test.md#test"));
+ });
+
describe('toAbsolute', function() {
it('should correctly transform as absolute', function() {
assert.equal(links.toAbsolute("http://google.fr"), "http://google.fr");