mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
multiple fixes for overridden symbols (#855)
- Don't add an "overrides" property to members that are merely inherited. - In the template, don't show both "overrides" and "inherited from" for the same member.
This commit is contained in:
parent
dfdce46683
commit
7e23a68c59
@ -201,7 +201,12 @@ function getInheritedAdditions(doclets, docs, documented) {
|
||||
// Indicate what the descendant is overriding. (We only care about the closest
|
||||
// ancestor. For classes A > B > C, if B#a overrides A#a, and C#a inherits B#a,
|
||||
// we don't want the doclet for C#a to say that it overrides A#a.)
|
||||
addDocletProperty([member], 'overrides', members[k].longname);
|
||||
if (docs.index.longname[member.longname]) {
|
||||
member.overrides = members[k].longname;
|
||||
}
|
||||
else {
|
||||
delete member.overrides;
|
||||
}
|
||||
|
||||
// Add the ancestor's docs unless the descendant overrides the ancestor AND
|
||||
// documents the override.
|
||||
|
||||
@ -32,7 +32,7 @@ if (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvalu
|
||||
<dd class="tag-since"><ul class="dummy"><li><?js= since ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.inherited && data.inherits) { ?>
|
||||
<?js if (data.inherited && data.inherits && !data.overrides) { ?>
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
<?js= this.linkto(data.inherits, this.htmlsafe(data.inherits)) ?>
|
||||
|
||||
5
test/fixtures/augmentstag.js
vendored
5
test/fixtures/augmentstag.js
vendored
@ -22,6 +22,11 @@ Foo.prototype.method1 = function() {};
|
||||
*/
|
||||
Foo.prototype.method2 = function() {};
|
||||
|
||||
/**
|
||||
* Third parent method.
|
||||
*/
|
||||
Foo.prototype.method3 = function() {};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends Foo
|
||||
|
||||
@ -101,10 +101,16 @@
|
||||
expect(bazMethod2.inherits).toBe('Bar#method2');
|
||||
});
|
||||
|
||||
it('When the grandparent has a method, and the parent overrides it, the child should say it overrides the parent', function() {
|
||||
it('When the grandparent has a method, the parent overrides it, and the child inherits it, the child should not say it overrides anything', function() {
|
||||
var bazMethod2 = docSet.getByLongname('Baz#method2')[0];
|
||||
|
||||
expect(bazMethod2.overrides).toBe('Bar#method2');
|
||||
expect(bazMethod2.overrides).not.toBeDefined();
|
||||
});
|
||||
|
||||
it('When the grandparent has a method, the parent inherits it, and the child overrides it, the child should say it overrides the parent', function() {
|
||||
var bazMethod3 = docSet.getByLongname('Baz#method3')[0];
|
||||
|
||||
expect(bazMethod3.overrides).toBe('Bar#method3');
|
||||
});
|
||||
|
||||
it('When an object is extended, and it overrides an ancestor property, the child does not include docs for the ancestor property.', function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user