feat(language-service): warn when a method isn't called in an event (#13437)
Closes 13435
This commit is contained in:

committed by
Victor Berchet

parent
4b3d135193
commit
9ec0a4e105
@ -130,6 +130,17 @@ describe('diagnostics', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should report a warning if an event results in a callable expression', () => {
|
||||
const code =
|
||||
` @Component({template: \`<div (click)="onClick"></div>\`}) export class MyComponent { onClick() { } }`;
|
||||
addCode(code, (fileName, content) => {
|
||||
const diagnostics = ngService.getDiagnostics(fileName);
|
||||
includeDiagnostic(
|
||||
diagnostics, 'Unexpected callable expression. Expected a method call', 'onClick',
|
||||
content);
|
||||
});
|
||||
});
|
||||
|
||||
function addCode(code: string, cb: (fileName: string, content?: string) => void) {
|
||||
const fileName = '/app/app.component.ts';
|
||||
const originalContent = mockHost.getFileContent(fileName);
|
||||
|
Reference in New Issue
Block a user