mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
support the nosideeffects tag (Closure Compiler only) (#605)
This commit is contained in:
parent
2f99af8fbb
commit
7738610a9f
@ -931,6 +931,12 @@ exports.closureTags = {
|
||||
onTagged: ignore
|
||||
},
|
||||
// Closure Compiler only
|
||||
nosideeffects: {
|
||||
onTagged: function(doclet) {
|
||||
doclet.modifies = [];
|
||||
}
|
||||
},
|
||||
// Closure Compiler only
|
||||
override: {
|
||||
mustNotHaveValue: true,
|
||||
onTagged: function(doclet) {
|
||||
|
||||
5
test/fixtures/nosideeffectstag.js
vendored
Normal file
5
test/fixtures/nosideeffectstag.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* A function that does nothing.
|
||||
* @nosideeffects
|
||||
*/
|
||||
function doNothing() {}
|
||||
21
test/specs/tags/nosideeffectstag.js
Normal file
21
test/specs/tags/nosideeffectstag.js
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
describe('@nosideeffects tag', function() {
|
||||
afterEach(function() {
|
||||
jasmine.restoreTagDictionary();
|
||||
});
|
||||
|
||||
describe('Closure Compiler tags', function() {
|
||||
beforeEach(function() {
|
||||
jasmine.replaceTagDictionary('closure');
|
||||
});
|
||||
|
||||
it('should set the doclet\'s `modifies` property to an empty array', function() {
|
||||
var docSet = jasmine.getDocSetFromFile('test/fixtures/nosideeffectstag.js');
|
||||
var doNothing = docSet.getByLongname('doNothing')[0];
|
||||
|
||||
expect(Array.isArray(doNothing.modifies)).toBe(true);
|
||||
expect(doNothing.modifies.length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user