Remove FunctionWithParamTokens. All test wrappers async, fakeAsync and inject now return just a Function instead of FunctionWithParamTokens. This makes them directly consumable by the test framework. Also the test framework code does not have to handle a union of Function and FunctionWithParamTokens everywhere. The Function returned by the above methods are considered asynchronous by the test framework if they return a Promise, synchronous otherwise. Closes #8257
14 lines
470 B
TypeScript
14 lines
470 B
TypeScript
import {PromiseCompleter} from 'angular2/src/facade/promise';
|
|
|
|
/**
|
|
* Injectable completer that allows signaling completion of an asynchronous test. Used internally.
|
|
*/
|
|
export class AsyncTestCompleter {
|
|
private _completer = new PromiseCompleter<any>();
|
|
done(value?: any) { this._completer.resolve(value); }
|
|
|
|
fail(error?: any, stackTrace?: string) { this._completer.reject(error, stackTrace); }
|
|
|
|
get promise(): Promise<any> { return this._completer.promise; }
|
|
}
|