mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
support preserve tag (Closure Compiler only) (#605)
This commit is contained in:
parent
e810cb7d0f
commit
60143a457f
@ -931,6 +931,8 @@ exports.closureTags = {
|
||||
polymerBehavior: {
|
||||
onTagged: ignore
|
||||
},
|
||||
// Closure Compiler only
|
||||
preserve: cloneTagDef(baseTags.license),
|
||||
private: {
|
||||
canHaveType: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
|
||||
2
test/fixtures/preservetag.js
vendored
Normal file
2
test/fixtures/preservetag.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/** @preserve My cool license goes here. */
|
||||
var x;
|
||||
43
test/specs/tags/preservetag.js
Normal file
43
test/specs/tags/preservetag.js
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
describe('@preserve 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 @preserve tag', function() {
|
||||
jasmine.getDocSetFromFile('test/fixtures/preservetag.js');
|
||||
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Closure Compiler tags', function() {
|
||||
beforeEach(function() {
|
||||
jasmine.replaceTagDictionary('closure');
|
||||
});
|
||||
|
||||
it('should set the doclet\'s `license` property to the tag value', function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/preservetag.js');
|
||||
var x = docSet.getByLongname('x')[0];
|
||||
|
||||
expect(x.license).toBe('My cool license goes here.');
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user