angular-cn/modules/angular2/test/testing
Julie Ralph 8490921fb3 feat(tests): manage asynchronous tests using zones
Instead of using injectAsync and returning a promise, use the `async` function
to wrap tests. This will run the test inside a zone which does not complete
the test until all asynchronous tasks have been completed.

`async` may be used with the `inject` function, or separately.

BREAKING CHANGE:

`injectAsync` is now deprecated. Instead, use the `async` function
to wrap any asynchronous tests.

Before:
```
it('should wait for returned promises', injectAsync([FancyService], (service) => {
  return service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
}));

it('should wait for returned promises', injectAsync([], () => {
  return somePromise.then(() => { expect(true).toEqual(true); });
}));
```

After:
```
it('should wait for returned promises', async(inject([FancyService], (service) => {
  service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
})));

// Note that if there is no injection, we no longer need `inject` OR `injectAsync`.
it('should wait for returned promises', async(() => {
  somePromise.then() => { expect(true).toEqual(true); });
}));
```

Closes #7735
2016-04-18 15:59:07 -07:00
..
static_assets fix(testing): remove test zone for now and rely on returned promises 2016-01-22 00:28:48 +00:00
fake_async_spec.ts refactor(view_compiler): codegen DI and Queries 2016-04-13 14:43:48 -07:00
test_component_builder_spec.ts revert(format): Revert "chore(format): update to latest formatter" 2016-04-12 09:41:01 -07:00
testing_internal_spec.ts revert(format): Revert "chore(format): update to latest formatter" 2016-04-12 09:41:01 -07:00
testing_public_browser_spec.dart feat(tests): manage asynchronous tests using zones 2016-04-18 15:59:07 -07:00
testing_public_browser_spec.ts feat(tests): manage asynchronous tests using zones 2016-04-18 15:59:07 -07:00
testing_public_spec.dart refactor(test): rename test_lib to testing 2015-10-13 10:36:49 -07:00
testing_public_spec.ts feat(tests): manage asynchronous tests using zones 2016-04-18 15:59:07 -07:00
utils_spec.ts refactor(core): move facades out of core 2015-11-07 01:36:06 +00:00