fix(testing): async/fakeAsync/inject/withModule helpers should pass through context to callback functions (#13718)

Make sure that context (`this`) that is passed to functions generated by test helpers is passed through to the callback functions. Enables usage of Jasmine's variable sharing system to prevent accidental memory leaks during test runs.
This commit is contained in:
Dimitri Benin
2016-12-31 11:50:03 +01:00
committed by Miško Hevery
parent d69717cf79
commit 5f40e5ba21
5 changed files with 80 additions and 37 deletions

View File

@ -67,7 +67,7 @@ export declare class TestBed implements Injector {
}): void;
configureTestingModule(moduleDef: TestModuleMetadata): void;
createComponent<T>(component: Type<T>): ComponentFixture<T>;
execute(tokens: any[], fn: Function): any;
execute(tokens: any[], fn: Function, context?: any): any;
get(token: any, notFoundValue?: any): any;
/** @experimental */ initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): void;
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): void;