mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Members of enum automatically get a default value.
This commit is contained in:
parent
2351776bdf
commit
ce435bed51
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "JSDoc",
|
||||
"version": "3.0.0alpha",
|
||||
"revision": "1319151616566",
|
||||
"revision": "1319671194463",
|
||||
"description": "An automatic documentation generator for javascript.",
|
||||
"keywords": [ "documentation", "javascript" ],
|
||||
"licenses": [
|
||||
|
||||
@ -319,6 +319,7 @@ function visitNode(node) {
|
||||
// members of an enum inherit the enum's type
|
||||
if (parent.doclet.type && !e.doclet.type) { e.doclet.type = parent.doclet.type; }
|
||||
delete e.doclet.undocumented;
|
||||
e.doclet.defaultvalue = e.doclet.meta.code.value;
|
||||
parent.doclet.properties.push(e.doclet);
|
||||
}
|
||||
}
|
||||
@ -511,6 +512,9 @@ function nodeToString(node) {
|
||||
else if (node.type === Token.GETELEM) {
|
||||
str = node.toSource(); // like: Foo['Bar']
|
||||
}
|
||||
else if (node.type === Token.NEG || node.type === Token.TRUE || node.type === Token.FALSE) {
|
||||
str = node.toSource(); // like -1
|
||||
}
|
||||
else {
|
||||
str = getTypeName(node);
|
||||
}
|
||||
|
||||
@ -15,7 +15,10 @@
|
||||
test('If no no comment is given for the property it is still included in the enum.', function() {
|
||||
assert.equal(tristate.properties[1].longname, 'TriState.FALSE');
|
||||
assert.equal(typeof tristate.properties[1].undocumented, 'undefined');
|
||||
|
||||
});
|
||||
|
||||
test('A property of an enum gets its defaultvalue set.', function() {
|
||||
assert.equal(tristate.properties[1].defaultvalue, -1);
|
||||
});
|
||||
|
||||
test('If a @type is given for the property it is reflected in the property value.', function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user