support the polymerBehavior tag (Closure Compiler only) (#605)

This commit is contained in:
Jeff Williams 2017-07-16 18:41:44 -07:00
parent 5432a2a6b0
commit e810cb7d0f
3 changed files with 48 additions and 0 deletions

View File

@ -927,6 +927,10 @@ exports.closureTags = {
polymer: {
onTagged: ignore
},
// Closure Compiler only
polymerBehavior: {
onTagged: ignore
},
private: {
canHaveType: true,
onTagged: function(doclet, tag) {

2
test/fixtures/polymerbehaviortag.js vendored Normal file
View File

@ -0,0 +1,2 @@
/** @polymerBehavior */
var MyPolymerBehavior = {};

View File

@ -0,0 +1,42 @@
'use strict';
describe('@polymerBehavior 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 @polymerBehavior tag', function() {
jasmine.getDocSetFromFile('test/fixtures/polymerbehaviortag.js');
expect(logger.error).toHaveBeenCalled();
});
});
describe('Closure Compiler tags', function() {
beforeEach(function() {
jasmine.replaceTagDictionary('closure');
});
it('should recognize the @polymerBehavior tag', function() {
jasmine.getDocSetFromFile('test/fixtures/polymerbehaviortag.js');
expect(logger.error).not.toHaveBeenCalled();
});
});
});