fix(language-service): Fix completions for input/output with alias (#28904)

This PR fixes a bug in autocompletion for @Input/@Output decorator with
an alias. The current implementation ignores the alias.

Credit for this work is attributed to @edgardmessias
The original work fixed the bug, but was lacking test.

PR Close #27959

PR Close #28904
This commit is contained in:
Keen Yee Liau
2019-01-30 10:34:36 -08:00
committed by Ben Lesh
parent 43181ea568
commit ad4a9bf03f
3 changed files with 32 additions and 4 deletions

View File

@ -187,6 +187,27 @@ export class MyComponent {
contains('/app/my.component.ts', 'tree', 'children');
});
it('should work with input and output', () => {
addCode(
`
@Component({
selector: 'foo-component',
template: \`
<div string-model ~{stringMarker}="text"></div>
<div number-model ~{numberMarker}="value"></div>
\`,
})
export class FooComponent {
text: string;
value: number;
}
`,
(fileName) => {
contains(fileName, 'stringMarker', '[model]', '(model)');
contains(fileName, 'numberMarker', '[inputAlias]', '(outputAlias)');
});
});
function addCode(code: string, cb: (fileName: string, content?: string) => void) {
const fileName = '/app/app.component.ts';
const originalContent = mockHost.getFileContent(fileName);