diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js index 3da048c0..3b0f83e2 100644 --- a/lib/jsdoc/util/templateHelper.js +++ b/lib/jsdoc/util/templateHelper.js @@ -231,8 +231,8 @@ exports.getSignatureParams = function(d, optClass) { /** * Retrieve links to types that the member can return. - * @param {object} d The doclet whose types will be retrieved. - * @return {array} HTML links to types that the member can return. + * @param {Object} d The doclet whose types will be retrieved. + * @return {Array.} HTML links to types that the member can return. */ exports.getSignatureReturns = function(d) { var returnTypes = []; @@ -249,7 +249,7 @@ exports.getSignatureReturns = function(d) { if (returnTypes && returnTypes.length) { returnTypes = returnTypes.map(function(r) { - return linkto(r); + return linkto(r, htmlsafe(r)); }); } diff --git a/test/specs/jsdoc/util/templateHelper.js b/test/specs/jsdoc/util/templateHelper.js index 44cd122b..8894c158 100644 --- a/test/specs/jsdoc/util/templateHelper.js +++ b/test/specs/jsdoc/util/templateHelper.js @@ -321,8 +321,26 @@ describe("jsdoc/util/templateHelper", function() { // TODO }); - xdescribe("getSignatureReturns", function() { - // TODO + describe("getSignatureReturns", function() { + // TODO: more tests + + it("returns a value with correctly escaped HTML", function() { + var mockDoclet = { + returns: [ + { + type: { + names: [ + 'Array.' + ] + } + } + ] + }; + + var html = helper.getSignatureReturns(mockDoclet); + expect( html.indexOf('Array.') ).toEqual(-1); + expect( html.indexOf('Array.<string>') ).toBeGreaterThan(-1); + }); }); xdescribe("getAncestorLinks", function() {