refactor: change provide(...) for {provide: ...}

- provide() is deprecated,
- {} syntax is required by the offline compiler
This commit is contained in:
Victor Berchet
2016-06-02 17:30:40 -07:00
parent 27a47e7841
commit a6ad61d83e
128 changed files with 676 additions and 728 deletions

View File

@ -92,8 +92,8 @@ export function beforeEach(fn: Function): void {
* Example:
*
* beforeEachProviders(() => [
* provide(Compiler, {useClass: MockCompiler}),
* provide(SomeToken, {useValue: myValue}),
* {provide: Compiler, useClass: MockCompiler},
* {provide: SomeToken, useValue: myValue},
* ]);
*/
export function beforeEachProviders(fn): void {
@ -121,13 +121,14 @@ function _it(jsmFn: Function, name: string, testFn: Function, testTimeOut: numbe
var timeOut = Math.max(globalTimeOut, testTimeOut);
jsmFn(name, (done) => {
var completerProvider = provide(AsyncTestCompleter, {
var completerProvider = {
provide: AsyncTestCompleter,
useFactory: () => {
// Mark the test as async when an AsyncTestCompleter is injected in an it()
if (!inIt) throw new Error('AsyncTestCompleter can only be injected in an "it()"');
return new AsyncTestCompleter();
}
});
};
testInjector.addProviders([completerProvider]);
runner.run();