fix(fake_async): share zone between beforeEach and it

This is needed for the case if a `beforeEach` instantiates
`NgZone`and the `it` uses
`TestComponentBuilder.createFakeAsync`.

Otherwise the `NgZone` will use the root zone as parent,
and `TestComponentBuilder.createFakeAsync` will always return
undefined as `tick` does not forward promises created
under the zone of `NgZone`.
This commit is contained in:
Tobias Bosch
2016-08-02 04:45:15 -07:00
parent 3ce11ed58c
commit 16cc9b46aa
3 changed files with 72 additions and 27 deletions

View File

@ -14,15 +14,19 @@
import {SchemaMetadata} from '../index';
import {resetFakeAsyncZone} from './fake_async';
import {TestBed, TestModuleMetadata, getTestBed} from './test_bed';
declare var global: any;
var _global = <any>(typeof window === 'undefined' ? global : window);
// Reset the test providers before each test.
// Reset the test providers and the fake async zone before each test.
if (_global.beforeEach) {
_global.beforeEach(() => { TestBed.resetTestingModule(); });
_global.beforeEach(() => {
TestBed.resetTestingModule();
resetFakeAsyncZone();
});
}
/**