refactor(core): misc changes and integrate review feedback on #19996
closes #20224
This commit is contained in:
@ -229,10 +229,11 @@ export function main() {
|
||||
|
||||
const overwrittenValue = {};
|
||||
|
||||
TestBed.overrideProvider(SomeDep, {useFactory: () => overwrittenValue, deps: []});
|
||||
const fixture =
|
||||
TestBed.overrideProvider(SomeDep, {useFactory: () => overwrittenValue, deps: []})
|
||||
.configureTestingModule({providers: [SomeDep], imports: [SomeModule]})
|
||||
.createComponent(SomePublicComponent);
|
||||
|
||||
const fixture = TestBed.configureTestingModule({providers: [SomeDep], imports: [SomeModule]})
|
||||
.createComponent(SomePublicComponent);
|
||||
expect(fixture.componentInstance.dep).toBe(overwrittenValue);
|
||||
});
|
||||
|
||||
|
@ -163,8 +163,8 @@ export class TestBed implements Injector {
|
||||
static overrideProvider(token: any, provider: {
|
||||
useFactory: Function,
|
||||
deps: any[],
|
||||
}): void;
|
||||
static overrideProvider(token: any, provider: {useValue: any;}): void;
|
||||
}): typeof TestBed;
|
||||
static overrideProvider(token: any, provider: {useValue: any;}): typeof TestBed;
|
||||
static overrideProvider(token: any, provider: {
|
||||
useFactory?: Function,
|
||||
useValue?: any,
|
||||
@ -503,7 +503,7 @@ export class TestBed implements Injector {
|
||||
overrideTemplateUsingTestingModule(component: Type<any>, template: string) {
|
||||
this._assertNotInstantiated('overrideTemplateUsingTestingModule', 'override template');
|
||||
|
||||
@Component({selector: 'empty', template: template})
|
||||
@Component({selector: 'empty', template})
|
||||
class OverrideComponent {
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user