Skip to content

Commit 8190df5

Browse files
committed
fix(app): setters arguments correctly documented
fix #1062
1 parent 2ff7c21 commit 8190df5

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/app/compiler/angular/deps/helpers/class-helper.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,7 @@ export class ClassHelper {
271271
type: 'void',
272272
deprecated: false,
273273
deprecationMessage: '',
274-
args: nodeAccessor.parameters.map(param => {
275-
return {
276-
name: param.name.text,
277-
type: param.type ? kindToType(param.type.kind) : ''
278-
};
279-
}),
274+
args: nodeAccessor.parameters.map(param => this.visitArgument(param)),
280275
returnType: nodeAccessor.type ? this.visitType(nodeAccessor.type) : 'void',
281276
line: this.getPosition(nodeAccessor, sourceFile).line + 1
282277
};

test/fixtures/todomvc-ng2/src/app/shared/components/dumb-component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, Input, Output, HostBinding, HostListener } from '@angular/core';
2+
import { Todo } from '../models/todo.model';
23

34
import { DumbParentComponent } from './dumb-parent-component';
45

@@ -17,6 +18,8 @@ export class DumbComponent extends DumbParentComponent {
1718
*/
1819
emptyProperty = '';
1920

21+
_todo;
22+
2023
/**
2124
* @example
2225
* component input
@@ -62,4 +65,11 @@ export class DumbComponent extends DumbParentComponent {
6265
emptyMethod(emptyParam: string) {
6366
return emptyParam;
6467
}
68+
69+
/**
70+
* @param {VisibleLayer} value
71+
*/
72+
set visibleTodos(value: Todo) {
73+
this._todo = value;
74+
}
6575
}

test/src/cli/cli-generation-big-app.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,11 @@ describe('CLI simple generation - big app', () => {
429429
expect(file).to.contain('Setter of _fullName');
430430

431431
expect(file).to.contain('Inputs');
432+
433+
file = read(distFolder + '/components/DumbComponent.html');
434+
expect(file).to.contain(
435+
'<code>visibleTodos(value: <a href="../classes/Todo.html" target="_self">Todo</a>)</code>'
436+
);
432437
});
433438

434439
it('should support QualifiedName for type', () => {

0 commit comments

Comments
 (0)