mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
support the implicitCast tag (Closure Compiler only) (#605)
This commit is contained in:
parent
adf742615e
commit
e45a719cd0
@ -882,6 +882,10 @@ exports.closureTags = {
|
||||
},
|
||||
final: cloneTagDef(baseTags.readonly),
|
||||
implements: cloneTagDef(baseTags.implements),
|
||||
// Closure Compiler only
|
||||
implicitcast: {
|
||||
onTagged: ignore
|
||||
},
|
||||
inheritdoc: cloneTagDef(baseTags.inheritdoc),
|
||||
interface: cloneTagDef(baseTags.interface, {
|
||||
canHaveName: false,
|
||||
|
||||
7
test/fixtures/implicitcasttag.js
vendored
Normal file
7
test/fixtures/implicitcasttag.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
function Foo() {}
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @implicitCast
|
||||
*/
|
||||
Foo.prototype.bar;
|
||||
42
test/specs/tags/implicitcasttag.js
Normal file
42
test/specs/tags/implicitcasttag.js
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
describe('@implicitCast 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 @implicitCast tag', function() {
|
||||
jasmine.getDocSetFromFile('test/fixtures/implicitcasttag.js');
|
||||
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Closure Compiler tags', function() {
|
||||
beforeEach(function() {
|
||||
jasmine.replaceTagDictionary('closure');
|
||||
});
|
||||
|
||||
it('should recognize the @implicitCast tag', function() {
|
||||
jasmine.getDocSetFromFile('test/fixtures/implicitcasttag.js');
|
||||
|
||||
expect(logger.error).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user