fixed target attribute for external links

This commit is contained in:
Tomas Dvorak
2016-06-07 18:34:36 +02:00
parent 15123805d1
commit 762fe16a17
2 changed files with 15 additions and 3 deletions
+14 -2
View File
@@ -87,6 +87,18 @@ describe('resolveLinks', function() {
});
});
describe('External link', function() {
var TEST = '<p>This is a <a href="http://www.github.com">external link</a></p>';
it('should have target="_blank" attribute', function() {
var $ = cheerio.load(TEST);
return resolveLinks('hello.md', resolveFileBasic, $)
.then(function() {
var link = $('a');
expect(link.attr('target')).toBe('_blank');
});
});
});
});
+1 -1
View File
@@ -24,7 +24,7 @@ function resolveLinks(currentFile, resolveFile, $) {
}
if (LocationUtils.isExternal(href)) {
$a.attr('_target', 'blank');
$a.attr('target', '_blank');
return;
}