diff --git a/lib/jsdoc/tag/dictionary/definitions.js b/lib/jsdoc/tag/dictionary/definitions.js index 34caa932..d52bc434 100644 --- a/lib/jsdoc/tag/dictionary/definitions.js +++ b/lib/jsdoc/tag/dictionary/definitions.js @@ -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), diff --git a/test/fixtures/fileoverviewtag.js b/test/fixtures/fileoverviewtag.js new file mode 100644 index 00000000..0c131728 --- /dev/null +++ b/test/fixtures/fileoverviewtag.js @@ -0,0 +1,3 @@ +/** + * @fileoverview Overview of this file. + */ diff --git a/test/specs/tags/fileoverviewtag.js b/test/specs/tags/fileoverviewtag.js new file mode 100644 index 00000000..36cf141c --- /dev/null +++ b/test/specs/tags/fileoverviewtag.js @@ -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); + }); + }); +}); diff --git a/test/specs/tags/filetag.js b/test/specs/tags/filetag.js new file mode 100644 index 00000000..6d8365c9 --- /dev/null +++ b/test/specs/tags/filetag.js @@ -0,0 +1,5 @@ +'use strict'; + +xdescribe('@file tag', function() { + // TODO: add tests +});