mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
keep the link text for longnames with variations (#857)
This commit is contained in:
parent
59fec8c696
commit
60b239fd33
@ -264,7 +264,7 @@ function hasUrlPrefix(text) {
|
||||
|
||||
function isComplexTypeExpression(expr) {
|
||||
// record types, type unions, and type applications all count as "complex"
|
||||
return expr.search(/[{(|]/) !== -1 || expr.search(/</) > 0;
|
||||
return /^{.+}$/.test(expr) || /^.+\|.+$/.test(expr) || /^.+<.+>$/.test(expr);
|
||||
}
|
||||
|
||||
function fragmentHash(fragmentId) {
|
||||
|
||||
@ -333,11 +333,13 @@ describe("jsdoc/util/templateHelper", function() {
|
||||
beforeEach(function() {
|
||||
helper.longnameToUrl.linktoTest = 'test.html';
|
||||
helper.longnameToUrl.LinktoFakeClass = 'fakeclass.html';
|
||||
helper.longnameToUrl['Foo#bar(baz)'] = 'foo-bar-baz.html';
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
delete helper.longnameToUrl.linktoTest;
|
||||
delete helper.longnameToUrl.LinktoFakeClass;
|
||||
delete helper.longnameToUrl['Foo#bar(baz)'];
|
||||
});
|
||||
|
||||
it('returns the longname if only the longname is specified and has no URL', function() {
|
||||
@ -414,6 +416,12 @@ describe("jsdoc/util/templateHelper", function() {
|
||||
expect(logger.error).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not treat a longname with a variation as a type application', function() {
|
||||
var link = helper.linkto('Foo#bar(baz)', 'link text');
|
||||
|
||||
expect(link).toBe('<a href="foo-bar-baz.html">link text</a>');
|
||||
});
|
||||
|
||||
it('returns a link when a URL is specified', function() {
|
||||
var link = helper.linkto('http://example.com');
|
||||
expect(link).toBe('<a href="http://example.com">http://example.com</a>');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user