test(language-service): recognize inputs/ouputs declared in decorator (#34875)
This commit adds a regression test to check that the language service recognizes inputs and outputs declared in a directive decorator. See #34874. PR Close #34875
This commit is contained in:
parent
1ea04ffc05
commit
68025ce09a
|
@ -646,6 +646,14 @@ describe('diagnostics', () => {
|
||||||
expect(ngDiags).toEqual([]);
|
expect(ngDiags).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Issue https://github.com/angular/angular/issues/34874
|
||||||
|
it('should recognize inputs and outputs listed inside directive decorators', () => {
|
||||||
|
mockHost.override(
|
||||||
|
TEST_TEMPLATE, `<div hint-model [hint]="title" (hintChange)="myClick($event)"></div>`);
|
||||||
|
const ngDiags = ngLS.getSemanticDiagnostics(TEST_TEMPLATE);
|
||||||
|
expect(ngDiags).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
it('should be able to resolve modules using baseUrl', () => {
|
it('should be able to resolve modules using baseUrl', () => {
|
||||||
mockHost.override(APP_COMPONENT, `
|
mockHost.override(APP_COMPONENT, `
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
|
@ -34,6 +34,7 @@ import * as ParsingCases from './parsing-cases';
|
||||||
ParsingCases.CaseMissingClosing,
|
ParsingCases.CaseMissingClosing,
|
||||||
ParsingCases.CaseUnknown,
|
ParsingCases.CaseUnknown,
|
||||||
ParsingCases.EmptyInterpolation,
|
ParsingCases.EmptyInterpolation,
|
||||||
|
ParsingCases.HintModel,
|
||||||
ParsingCases.NoValueAttribute,
|
ParsingCases.NoValueAttribute,
|
||||||
ParsingCases.NumberModel,
|
ParsingCases.NumberModel,
|
||||||
ParsingCases.Pipes,
|
ParsingCases.Pipes,
|
||||||
|
|
|
@ -60,6 +60,16 @@ export class NumberModel {
|
||||||
@Output('outputAlias') modelChange: EventEmitter<number> = new EventEmitter();
|
@Output('outputAlias') modelChange: EventEmitter<number> = new EventEmitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[hint-model]',
|
||||||
|
inputs: ['hint'],
|
||||||
|
outputs: ['hintChange'],
|
||||||
|
})
|
||||||
|
export class HintModel {
|
||||||
|
hint: string = 'hint';
|
||||||
|
hintChange: EventEmitter<string> = new EventEmitter();
|
||||||
|
}
|
||||||
|
|
||||||
interface Person {
|
interface Person {
|
||||||
name: string;
|
name: string;
|
||||||
age: number;
|
age: number;
|
||||||
|
|
Loading…
Reference in New Issue