diff --git a/lib/jsdoc/tag/dictionary/definitions.js b/lib/jsdoc/tag/dictionary/definitions.js index 6bb1214c..46e4dbdd 100644 --- a/lib/jsdoc/tag/dictionary/definitions.js +++ b/lib/jsdoc/tag/dictionary/definitions.js @@ -974,6 +974,10 @@ exports.closureTags = { suppress: { onTagged: ignore }, + // Closure Compiler only + template: { + onTagged: ignore + }, 'this': cloneTagDef(baseTags.this), throws: cloneTagDef(baseTags.throws), type: cloneTagDef(baseTags.type, { diff --git a/test/fixtures/templatetag.js b/test/fixtures/templatetag.js new file mode 100644 index 00000000..84448dc3 --- /dev/null +++ b/test/fixtures/templatetag.js @@ -0,0 +1,6 @@ +/** + * @param {T} t + * @constructor + * @template T + */ +function Container(t) {} diff --git a/test/specs/tags/templatetag.js b/test/specs/tags/templatetag.js new file mode 100644 index 00000000..afedc3e1 --- /dev/null +++ b/test/specs/tags/templatetag.js @@ -0,0 +1,42 @@ +'use strict'; + +describe('@template tag', function() { + var env = require('jsdoc/env'); + var logger = require('jsdoc/util/logger'); + + var allowUnknownTags = Boolean(env.conf.tags.allowUnknownTags); + + beforeEach(function() { + env.conf.tags.allowUnknownTags = false; + spyOn(logger, 'error'); + }); + + afterEach(function() { + jasmine.restoreTagDictionary(); + env.conf.tags.allowUnknownTags = allowUnknownTags; + }); + + describe('JSDoc tags', function() { + beforeEach(function() { + jasmine.replaceTagDictionary('jsdoc'); + }); + + it('should not recognize the @template tag', function() { + jasmine.getDocSetFromFile('test/fixtures/templatetag.js'); + + expect(logger.error).toHaveBeenCalled(); + }); + }); + + describe('Closure Compiler tags', function() { + beforeEach(function() { + jasmine.replaceTagDictionary('closure'); + }); + + it('should recognize the @template tag', function() { + jasmine.getDocSetFromFile('test/fixtures/templatetag.js'); + + expect(logger.error).not.toHaveBeenCalled(); + }); + }); +});