mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added support for @readonly tag.
This commit is contained in:
parent
8f5f41f78c
commit
97ae97b46f
@ -9,7 +9,7 @@
|
||||
exports.defineTags = function(dictionary) {
|
||||
|
||||
dictionary.defineTag('access', {
|
||||
musHaveValue: true,
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
if ( /^(private|protected)$/.test(tag.value) ) {
|
||||
doclet.access = tag.value;
|
||||
@ -23,7 +23,7 @@
|
||||
});
|
||||
|
||||
dictionary.defineTag('author', {
|
||||
musHaveValue: true,
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
doclet.author = tag.value;
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
.synonym('const');
|
||||
|
||||
dictionary.defineTag('copyright', {
|
||||
musHaveValue: true,
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
doclet.copyright = tag.value;
|
||||
|
||||
@ -319,6 +319,16 @@
|
||||
}
|
||||
});
|
||||
|
||||
// use this instead of old deprecated @final tag
|
||||
dictionary.defineTag('readonly', {
|
||||
mustNotHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
doclet.readonly = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
dictionary.defineTag('requires', {
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
|
||||
10
test/cases/readonlytag.js
Normal file
10
test/cases/readonlytag.js
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function Collection() {
|
||||
|
||||
/** @readonly */
|
||||
this.length = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ testFile('test/t/cases/globaltag.js');
|
||||
testFile('test/t/cases/ignoretag.js');
|
||||
testFile('test/t/cases/paramtag.js');
|
||||
testFile('test/t/cases/privatetag.js');
|
||||
testFile('test/t/cases/readonlytag.js');
|
||||
testFile('test/t/cases/requirestag.js');
|
||||
testFile('test/t/cases/returnstag.js');
|
||||
testFile('test/t/cases/seetag.js');
|
||||
|
||||
11
test/t/cases/readonlytag.js
Normal file
11
test/t/cases/readonlytag.js
Normal file
@ -0,0 +1,11 @@
|
||||
(function() {
|
||||
var docSet = testhelpers.getDocSetFromFile('test/cases/readonlytag.js'),
|
||||
Collection = docSet.getByLongname('Collection')[0],
|
||||
length = docSet.getByLongname('Collection#length')[0];
|
||||
|
||||
//dump(docSet.doclets); exit(0);
|
||||
|
||||
test('When a symbol has an @readonly tag, the doclet has an readonly property that is true.', function() {
|
||||
assert.equal(length.readonly, true);
|
||||
});
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user