Skip to content

Commit

Permalink
support the nocollapse tag (Closure Compiler only) (jsdoc#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Jul 17, 2017
1 parent 157255f commit 21583fe
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/jsdoc/tag/dictionary/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,10 @@ exports.closureTags = {
onTagged: ignore
},
// Closure Compiler only
nocollapse: {
onTagged: ignore
},
// Closure Compiler only
override: {
mustNotHaveValue: true,
onTagged: function(doclet) {
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/nocollapsetag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* A namespace.
* @const
*/
var foo = {};

/** @nocollapse */
foo.bar = true;
42 changes: 42 additions & 0 deletions test/specs/tags/nocollapsetag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

describe('@nocollapse 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 @nocollapse tag', function() {
jasmine.getDocSetFromFile('test/fixtures/nocollapsetag.js');

expect(logger.error).toHaveBeenCalled();
});
});

describe('Closure Compiler tags', function() {
beforeEach(function() {
jasmine.replaceTagDictionary('closure');
});

it('should recognize the @nocollapse tag', function() {
jasmine.getDocSetFromFile('test/fixtures/nocollapsetag.js');

expect(logger.error).not.toHaveBeenCalled();
});
});
});

0 comments on commit 21583fe

Please sign in to comment.