mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
give doclets a longname even if the name is empty (#643)
This commit is contained in:
parent
f635b10b6f
commit
1566421a62
@ -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
9
test/fixtures/classwithoutname.js
vendored
Normal 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() {}
|
||||
});
|
||||
14
test/specs/documentation/classwithoutname.js
Normal file
14
test/specs/documentation/classwithoutname.js
Normal 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('');
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user