use the variation to ensure a unique ID for each doclet

This commit is contained in:
Jeff Williams 2014-12-21 17:27:40 -08:00
parent cd23d479a1
commit 47aad100fc
2 changed files with 15 additions and 1 deletions

View File

@ -67,7 +67,7 @@ function getNamespace(kind) {
} }
function formatNameForLink(doclet, options) { 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] || ''; var scopePunc = exports.scopeToPunc[doclet.scope] || '';
// Only prepend the scope punctuation if it's not the same character that marks the start of a // Only prepend the scope punctuation if it's not the same character that marks the start of a

View File

@ -1548,6 +1548,20 @@ describe("jsdoc/util/templateHelper", function() {
expect(docletUrl).toBe('Milk.html#calcium'); 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() { describe("resolveAuthorLinks", function() {