fix(ivy): apply all overrides from TestBed, not the last one only (#27734)

In some cases in our tests we can define multiple overrides for a given class. As a result, only the last override is actually applied due to the fact that we store overrides in a Type<->Override map. This update changes the logic to keep all overrides defined in a given test for a Type (i.e. Type<->Override[] map) and applies them one by one at resolution phase. This behavior is more inline with the previous TestBed.

PR Close #27734
This commit is contained in:
Andrew Kushnir
2018-12-18 10:30:14 -08:00
committed by Matias Niemelä
parent cdd737e28b
commit 509aa61619
2 changed files with 16 additions and 11 deletions

View File

@ -388,12 +388,11 @@ class CompWithUrlTemplate {
.overridePipe(SomePipe, {set: {name: 'somePipe'}})
.overridePipe(SomePipe, {add: {pure: false}});
});
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)')
.it('should work', () => {
const compFixture = TestBed.createComponent(SomeComponent);
compFixture.detectChanges();
expect(compFixture.nativeElement).toHaveText('transformed hello');
});
it('should work', () => {
const compFixture = TestBed.createComponent(SomeComponent);
compFixture.detectChanges();
expect(compFixture.nativeElement).toHaveText('transformed hello');
});
});
describe('template', () => {