escape less-than sign in signature headings (#307)

This commit is contained in:
Jeff Williams 2013-01-17 07:20:23 -08:00
parent 2ad44a6c6a
commit 4a57a3718c
2 changed files with 23 additions and 5 deletions

View File

@ -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<string>} HTML links to types that the member can return.
* @param {Object} d The doclet whose types will be retrieved.
* @return {Array.<string>} 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));
});
}

View File

@ -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.<string>'
]
}
}
]
};
var html = helper.getSignatureReturns(mockDoclet);
expect( html.indexOf('Array.<string>') ).toEqual(-1);
expect( html.indexOf('Array.&lt;string>') ).toBeGreaterThan(-1);
});
});
xdescribe("getAncestorLinks", function() {