fix(core/testing): clean up the core testing public API (#9466)

Previously, we were exporting internal mocks and helpers. Move these
to core/testing/testing_internal or remove them if they were
never used.

Remove deprecated items - injectAsync, clearPendingTimers.

BREAKING CHANGE:

Remove the following APIs from `@angular/core/testing`, which have been deprecated or were
never intended to be publicly exported:

```
injectAsync
clearPendingTimers
Log
MockAppliacationHref
MockNgZone
clearPendingTimers
getTypeOf
instantiateType
```

Instead of `injectAsync`, use `async(inject())`.

`clearPendingTimers` is no longer required.
This commit is contained in:
Julie Ralph
2016-06-23 17:10:22 -07:00
committed by GitHub
parent 3d8eb8cbca
commit 8a9e9c7bd3
27 changed files with 71 additions and 151 deletions

View File

@ -6,8 +6,6 @@ export declare function beforeEach(fn: Function): void;
export declare function beforeEachProviders(fn: () => Array<any>): void;
export declare function clearPendingTimers(): void;
export declare var ddescribe: Function;
export declare var describe: Function;
@ -26,54 +24,17 @@ export declare function flushMicrotasks(): void;
export declare function getTestInjector(): TestInjector;
export declare function getTypeOf(instance: any): any;
export declare function iit(name: string, fn: Function, timeOut?: number): void;
export declare function inject(tokens: any[], fn: Function): Function;
export declare function injectAsync(tokens: any[], fn: Function): Function;
export declare class InjectSetupWrapper {
constructor(_providers: () => any);
inject(tokens: any[], fn: Function): Function;
injectAsync(tokens: any[], fn: Function): Function;
}
export declare function instantiateType(type: Function, params?: any[]): any;
export declare function it(name: string, fn: Function, timeOut?: number): void;
export declare class Log {
logItems: any[];
constructor();
add(value: any): void;
fn(value: any): (a1?: any, a2?: any, a3?: any, a4?: any, a5?: any) => void;
clear(): void;
result(): string;
}
export declare class MockApplicationRef extends ApplicationRef {
registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
registerDisposeListener(dispose: () => void): void;
bootstrap<C>(componentFactory: ComponentFactory<C>): ComponentRef<C>;
injector: Injector;
zone: NgZone;
run(callback: Function): any;
waitForAsyncInitializers(): Promise<any>;
dispose(): void;
tick(): void;
componentTypes: Type[];
}
export declare class MockNgZone extends NgZone {
constructor();
onStable: EventEmitter<any>;
run(fn: Function): any;
runOutsideAngular(fn: Function): any;
simulateZoneExit(): void;
}
export declare function resetBaseTestProviders(): void;
export declare function setBaseTestProviders(platformProviders: Array<Type | Provider | any[]>, applicationProviders: Array<Type | Provider | any[]>): void;