give doclets a longname even if the name is empty (#643)

This commit is contained in:
Jeff Williams 2014-04-26 10:57:10 -07:00
parent f635b10b6f
commit 1566421a62
3 changed files with 28 additions and 0 deletions

View File

@ -144,6 +144,11 @@ exports.resolve = function(doclet) {
if (about.variation) {
doclet.variation = about.variation;
}
// if we never found a longname, just use an empty string
if (!doclet.longname) {
doclet.longname = '';
}
};
/**

9
test/fixtures/classwithoutname.js vendored Normal file
View File

@ -0,0 +1,9 @@
// JSDoc should not be able to identify the name of this class.
var MyClass = Class.define({
/**
* Create an instance of MyClass.
* @constructs
*/
initialize: function() {}
});

View File

@ -0,0 +1,14 @@
/*global describe, expect, it, jasmine */
describe('class without a name', function() {
var docSet = jasmine.getDocSetFromFile('test/fixtures/classwithoutname.js').doclets
.filter(function(doclet) {
return doclet.name === '';
});
it('When the doclet for a class has an empty name, it should also have an empty longname', function() {
expect(docSet).toBeDefined();
expect(docSet.length).toBe(1);
expect(docSet[0].description).toBe('Create an instance of MyClass.');
expect(docSet[0].longname).toBe('');
});
});