fix(compiler): Safe property access expressions work in event bindings (#11724)

This commit is contained in:
Chuck Jazdzewski
2016-09-20 14:54:53 -07:00
committed by Igor Minar
parent fdb22bd185
commit a95d65241c
2 changed files with 21 additions and 3 deletions

View File

@ -79,6 +79,24 @@ function declareTests({useJit}: {useJit: boolean}) {
expect(fixture.nativeElement).toHaveText('counting method value');
expect(MyCountingComp.calls).toBe(1);
});
it('should evalute a conditional in a statement binding', () => {
@Component({selector: 'some-comp', template: '<p (click)="nullValue?.click()"></p>'})
class SomeComponent {
nullValue: SomeReferencedClass;
}
class SomeReferencedClass {
click() {}
}
expect(() => {
const fixture = TestBed.configureTestingModule({declarations: [SomeComponent]})
.createComponent(SomeComponent);
fixture.detectChanges(/* checkNoChanges */ false);
}).not.toThrow();
});
});
describe('providers', () => {