diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js index fe96e1d3..78886687 100644 --- a/lib/jsdoc/util/templateHelper.js +++ b/lib/jsdoc/util/templateHelper.js @@ -67,7 +67,7 @@ function getNamespace(kind) { } function formatNameForLink(doclet, options) { - var newName = getNamespace(doclet.kind) + (doclet.name || ''); + var newName = getNamespace(doclet.kind) + (doclet.name || '') + (doclet.variation || ''); var scopePunc = exports.scopeToPunc[doclet.scope] || ''; // Only prepend the scope punctuation if it's not the same character that marks the start of a diff --git a/test/specs/jsdoc/util/templateHelper.js b/test/specs/jsdoc/util/templateHelper.js index 1e384dd7..ab239f4f 100644 --- a/test/specs/jsdoc/util/templateHelper.js +++ b/test/specs/jsdoc/util/templateHelper.js @@ -1548,6 +1548,20 @@ describe("jsdoc/util/templateHelper", function() { expect(docletUrl).toBe('Milk.html#calcium'); }); + + it('should include the variation, if present, in the fragment ID', function() { + var variationDoclet = { + kind: 'function', + longname: 'Milk#fat(percent)', + name: 'fat', + memberof: 'Milk', + scope: 'instance', + variation: '(percent)' + }; + var docletUrl = helper.createLink(variationDoclet); + + expect(docletUrl).toBe('Milk.html#fat(percent)'); + }); }); describe("resolveAuthorLinks", function() {