fix(language-service): avoid throwing for invalid class declarations (#13257)

Fixes #13253
This commit is contained in:
Chuck Jazdzewski
2016-12-06 09:56:30 -08:00
committed by Alex Rickabaugh
parent 5614c4ff0f
commit 93556a5720
2 changed files with 7 additions and 1 deletions

View File

@ -115,6 +115,12 @@ describe('diagnostics', () => {
});
});
it('should not throw for an invalid class', () => {
const code = ` @Component({template: ''}) class`;
addCode(
code, fileName => { expect(() => ngService.getDiagnostics(fileName)).not.toThrow(); });
});
function addCode(code: string, cb: (fileName: string, content?: string) => void) {
const fileName = '/app/app.component.ts';
const originalContent = mockHost.getFileContent(fileName);