From 5432a2a6b0bddcb632487d96e72c0d9b418bebe5 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 16 Jul 2017 18:38:21 -0700 Subject: [PATCH] support the `polymer` tag (Closure Compiler only) (#605) --- lib/jsdoc/tag/dictionary/definitions.js | 4 +++ test/fixtures/polymertag.js | 5 +++ test/specs/tags/polymertag.js | 42 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 test/fixtures/polymertag.js create mode 100644 test/specs/tags/polymertag.js diff --git a/lib/jsdoc/tag/dictionary/definitions.js b/lib/jsdoc/tag/dictionary/definitions.js index 0b26b681..a062870a 100644 --- a/lib/jsdoc/tag/dictionary/definitions.js +++ b/lib/jsdoc/tag/dictionary/definitions.js @@ -923,6 +923,10 @@ exports.closureTags = { } }, param: cloneTagDef(baseTags.param), + // Closure Compiler only + polymer: { + onTagged: ignore + }, private: { canHaveType: true, onTagged: function(doclet, tag) { diff --git a/test/fixtures/polymertag.js b/test/fixtures/polymertag.js new file mode 100644 index 00000000..b7fa258c --- /dev/null +++ b/test/fixtures/polymertag.js @@ -0,0 +1,5 @@ +/** + * A Polymer class. + * @polymer + */ +function Foo() {} diff --git a/test/specs/tags/polymertag.js b/test/specs/tags/polymertag.js new file mode 100644 index 00000000..e67bf11d --- /dev/null +++ b/test/specs/tags/polymertag.js @@ -0,0 +1,42 @@ +'use strict'; + +describe('@polymer 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 @polymer tag', function() { + jasmine.getDocSetFromFile('test/fixtures/polymertag.js'); + + expect(logger.error).toHaveBeenCalled(); + }); + }); + + describe('Closure Compiler tags', function() { + beforeEach(function() { + jasmine.replaceTagDictionary('closure'); + }); + + it('should recognize the @polymer tag', function() { + jasmine.getDocSetFromFile('test/fixtures/polymertag.js'); + + expect(logger.error).not.toHaveBeenCalled(); + }); + }); +});