mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge remote-tracking branch 'brjs/fix-classdesc-in-modules'
This commit is contained in:
commit
3b865dde3f
@ -31,6 +31,10 @@
|
||||
<?js if (doc.classdesc) { ?>
|
||||
<div class="class-description"><?js= doc.classdesc ?></div>
|
||||
<?js } ?>
|
||||
<?js } else if (doc.kind === 'module' && doc.modules) { ?>
|
||||
<?js doc.modules.forEach(function(module) { ?>
|
||||
<div class="class-description"><?js= module.classdesc ?></div>
|
||||
<?js }) ?>
|
||||
<?js } ?>
|
||||
</header>
|
||||
|
||||
|
||||
8
test/fixtures/moduleisconstructor.js
vendored
8
test/fixtures/moduleisconstructor.js
vendored
@ -4,10 +4,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
Create a new configuration
|
||||
@param {string} id
|
||||
@constructor
|
||||
Create a new configuration.
|
||||
|
||||
@classdesc Describe the class here.
|
||||
@class
|
||||
@alias module:mymodule/config
|
||||
@param {string} id
|
||||
*/
|
||||
function Config(id) {
|
||||
/** Document me. */
|
||||
|
||||
@ -1,5 +1,43 @@
|
||||
/*global describe: true, expect: true, it: true, xdescribe: true */
|
||||
|
||||
xdescribe('module that exports a constructor', function() {
|
||||
// TODO
|
||||
describe('module that exports a constructor', function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/moduleisconstructor.js');
|
||||
var modules = docSet.doclets.filter(function(doclet) {
|
||||
return doclet.kind === 'module';
|
||||
});
|
||||
var classes = docSet.doclets.filter(function(doclet) {
|
||||
return doclet.kind === 'class';
|
||||
});
|
||||
|
||||
it('should include one doclet whose kind is "module"', function() {
|
||||
expect(modules.length).toBe(1);
|
||||
expect(modules[0].kind).toBe('module');
|
||||
});
|
||||
|
||||
it('should include one doclet whose kind is "class"', function() {
|
||||
expect(classes.length).toBe(1);
|
||||
expect(classes[0].kind).toBe('class');
|
||||
});
|
||||
|
||||
describe('class doclet', function() {
|
||||
it('should include a "description" property that contains the constructor description', function() {
|
||||
expect(classes[0].description).toEqual('Create a new configuration.');
|
||||
});
|
||||
|
||||
it('should include a "class-description" property', function() {
|
||||
expect(classes[0].classdesc).toEqual('Describe the class here.');
|
||||
});
|
||||
});
|
||||
|
||||
describe('module doclet', function() {
|
||||
it('should include a "description" property that contains the module description', function() {
|
||||
expect(modules[0].description).toEqual('Describe the module here.');
|
||||
});
|
||||
|
||||
// TODO: this is the missing piece of information -- the module property is not available when testing, but is available within the template
|
||||
xit('should be able to access the class information via the module', function() {
|
||||
expect(modules[0].module.description).toEqual('Create a new configuration.');
|
||||
expect(modules[0].module.classdesc).toEqual('Describe the class here.');
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user