refactor(core): conditionally disable tests for the view engine.

This commit is contained in:
Tobias Bosch 2017-02-21 08:15:15 -08:00 committed by Igor Minar
parent 7db93310f1
commit 90226f7714
1 changed files with 28 additions and 24 deletions

View File

@ -1380,35 +1380,39 @@ function declareTests({useJit, viewEngine}: {useJit: boolean, viewEngine: boolea
}));
}
it('should specify a location of an error that happened during change detection (text)',
() => {
TestBed.configureTestingModule({declarations: [MyComp]});
const template = '<div>{{a.b}}</div>';
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
// TODO(tbosch): delete these tests once view engine is the default as we handle
// these errors via source maps!
if (!viewEngine) {
it('should specify a location of an error that happened during change detection (text)',
() => {
TestBed.configureTestingModule({declarations: [MyComp]});
const template = '<div>{{a.b}}</div>';
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
expect(() => fixture.detectChanges()).toThrowError(/:0:5/);
});
expect(() => fixture.detectChanges()).toThrowError(/:0:5/);
});
it('should specify a location of an error that happened during change detection (element property)',
() => {
TestBed.configureTestingModule({declarations: [MyComp]});
const template = '<div [title]="a.b"></div>';
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
it('should specify a location of an error that happened during change detection (element property)',
() => {
TestBed.configureTestingModule({declarations: [MyComp]});
const template = '<div [title]="a.b"></div>';
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
expect(() => fixture.detectChanges()).toThrowError(/:0:5/);
});
expect(() => fixture.detectChanges()).toThrowError(/:0:5/);
});
it('should specify a location of an error that happened during change detection (directive property)',
() => {
TestBed.configureTestingModule({declarations: [MyComp, ChildComp, MyDir]});
const template = '<child-cmp [dirProp]="a.b"></child-cmp>';
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
it('should specify a location of an error that happened during change detection (directive property)',
() => {
TestBed.configureTestingModule({declarations: [MyComp, ChildComp, MyDir]});
const template = '<child-cmp [dirProp]="a.b"></child-cmp>';
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
expect(() => fixture.detectChanges()).toThrowError(/:0:11/);
});
expect(() => fixture.detectChanges()).toThrowError(/:0:11/);
});
}
});
it('should support imperative views', () => {