support the fileoverview tag in the Closure Compiler dictionary (#605)

This commit is contained in:
Jeff Williams 2017-07-16 17:03:01 -07:00
parent afe7c3564a
commit adf742615e
4 changed files with 45 additions and 0 deletions

View File

@ -871,6 +871,15 @@ exports.closureTags = {
onTagged: ignore
},
extends: cloneTagDef(baseTags.augments),
fileoverview: {
onTagged: function(doclet, tag) {
setNameToFile(doclet);
doclet.kind = 'file';
setDocletDescriptionToValue(doclet, tag);
doclet.preserveName = true;
}
},
final: cloneTagDef(baseTags.readonly),
implements: cloneTagDef(baseTags.implements),
inheritdoc: cloneTagDef(baseTags.inheritdoc),

3
test/fixtures/fileoverviewtag.js vendored Normal file
View File

@ -0,0 +1,3 @@
/**
* @fileoverview Overview of this file.
*/

View File

@ -0,0 +1,28 @@
'use strict';
describe('@fileoverview tag', function() {
describe('JSDoc tags', function() {
// @fileoverview is a synonym of @file, so this is covered by the @file tag tests
});
describe('Closure Compiler tags', function() {
var docSet = jasmine.getDocSetFromFile('test/fixtures/fileoverviewtag.js');
var fileDoc = docSet.getByLongname('[[string0]]')[0];
it('should set the doclet\'s name and longname to the file name', function() {
expect(fileDoc.name).toBe('[[string0]]');
});
it('should set the doclet\'s kind to `file`', function() {
expect(fileDoc.kind).toBe('file');
});
it('should use the value as a description', function() {
expect(fileDoc.description).toBe('Overview of this file.');
});
it('should set `preserveName` to `true`', function() {
expect(fileDoc.preserveName).toBe(true);
});
});
});

View File

@ -0,0 +1,5 @@
'use strict';
xdescribe('@file tag', function() {
// TODO: add tests
});