Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* This function is package-private. | ||
* | ||
* @package | ||
*/ | ||
function foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @package {Object.<string, number>} | ||
*/ | ||
var connectionPorts = { | ||
'devServer': 6464, | ||
'prodServer': 2232, | ||
'stagingServer': 4997 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict'; | ||
|
||
var definitions = require('jsdoc/tag/dictionary/definitions'); | ||
var dictionary = require('jsdoc/tag/dictionary'); | ||
var Dictionary = dictionary.Dictionary; | ||
var doclet = require('jsdoc/doclet'); | ||
var logger = require('jsdoc/util/logger'); | ||
|
||
var originalDictionary = dictionary; | ||
|
||
describe('@package tag', function() { | ||
var docSet = jasmine.getDocSetFromFile('test/fixtures/packagetag.js'); | ||
var foo = docSet.getByLongname('foo')[0]; | ||
|
||
it('When a symbol has a @package tag, the doclet has an `access` property set to `package`.', | ||
function() { | ||
expect(foo.access).toBe('package'); | ||
}); | ||
|
||
describe('JSDoc tags', function() { | ||
afterEach(function() { | ||
doclet._replaceDictionary(originalDictionary); | ||
}); | ||
|
||
it('When JSDoc tags are enabled, the @package tag does not accept a value.', function() { | ||
var dict = new Dictionary(); | ||
|
||
definitions.defineTags(dict, definitions.jsdocTags); | ||
doclet._replaceDictionary(dict); | ||
spyOn(logger, 'warn'); | ||
|
||
jasmine.getDocSetFromFile('test/fixtures/packagetag2.js'); | ||
|
||
expect(logger.warn).toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
describe('Closure Compiler tags', function() { | ||
afterEach(function() { | ||
doclet._replaceDictionary(originalDictionary); | ||
}); | ||
|
||
it('When Closure Compiler tags are enabled, the @package tag accepts a type expression.', | ||
function() { | ||
var connectionPorts; | ||
var dict = new Dictionary(); | ||
var privateDocs; | ||
|
||
definitions.defineTags(dict, definitions.closureTags); | ||
doclet._replaceDictionary(dict); | ||
spyOn(logger, 'warn'); | ||
|
||
privateDocs = jasmine.getDocSetFromFile('test/fixtures/packagetag2.js'); | ||
connectionPorts = privateDocs.getByLongname('connectionPorts')[0]; | ||
|
||
expect(logger.warn).not.toHaveBeenCalled(); | ||
|
||
expect(connectionPorts).toBeDefined(); | ||
expect(connectionPorts.access).toBe('package'); | ||
|
||
expect(connectionPorts.type).toBeDefined(); | ||
expect(connectionPorts.type.names).toBeDefined(); | ||
expect(connectionPorts.type.names.length).toBe(1); | ||
expect(connectionPorts.type.names[0]).toBe('Object.<string, number>'); | ||
}); | ||
}); | ||
}); |