diff --git a/modules/jsdoc/tag/dictionary/definitions.js b/modules/jsdoc/tag/dictionary/definitions.js index 226a4495..ecc1ee73 100644 --- a/modules/jsdoc/tag/dictionary/definitions.js +++ b/modules/jsdoc/tag/dictionary/definitions.js @@ -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) { diff --git a/test/cases/readonlytag.js b/test/cases/readonlytag.js new file mode 100644 index 00000000..30e826ce --- /dev/null +++ b/test/cases/readonlytag.js @@ -0,0 +1,10 @@ +/** +* @constructor +*/ +function Collection() { + + /** @readonly */ + this.length = 0; +} + + diff --git a/test/runner.js b/test/runner.js index 70460019..4fc27cbf 100644 --- a/test/runner.js +++ b/test/runner.js @@ -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'); diff --git a/test/t/cases/readonlytag.js b/test/t/cases/readonlytag.js new file mode 100644 index 00000000..f295ed35 --- /dev/null +++ b/test/t/cases/readonlytag.js @@ -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); + }); +})(); \ No newline at end of file