refactor(core): use ngOnDestroy
in providers
Note about the addition of `beforeEach(fakeAsync(inject(…))))` in some tests: `ApplicationRef` is now using `ngOnDestroy` and there is eager, including all of its dependencies which contain `NgZone`. The additional `fakeAsync` in `beforeEach` ensures that `NgZone` uses the fake async zone as parent, and not the root zone. BREAKING CHANGE (via deprecations): - `ApplicationRef.dispose` is deprecated. Destroy the module that was created during bootstrap instead by calling `NgModuleRef.destroy`. - `AplicationRef.registerDisposeListener` is deprecated. Use the `ngOnDestroy` lifecycle hook for providers or `NgModuleRef.onDestroy` instead. - `disposePlatform` is deprecated. Use `destroyPlatform` instead. - `PlatformRef.dipose()` is deprecated. Use `PlatformRef.destroy()` instead. - `PlatformRef.registerDisposeListener` is deprecated. Use `PlatformRef.onDestroy` instead. - `PlaformRef.diposed` is deprecated. Use `PlatformRef.destroyed` instead.
This commit is contained in:
@ -39,7 +39,7 @@ export function main() {
|
||||
beforeEach(
|
||||
() => { TestBed.configureCompiler({providers: [{provide: XHR, useClass: SpyXHR}]}); });
|
||||
|
||||
beforeEach(inject(
|
||||
beforeEach(fakeAsync(inject(
|
||||
[Compiler, TestComponentBuilder, XHR, DirectiveResolver, Injector],
|
||||
(_compiler: Compiler, _tcb: TestComponentBuilder, _xhr: SpyXHR,
|
||||
_dirResolver: MockDirectiveResolver, _injector: Injector) => {
|
||||
@ -48,7 +48,7 @@ export function main() {
|
||||
xhr = _xhr;
|
||||
dirResolver = _dirResolver;
|
||||
injector = _injector;
|
||||
}));
|
||||
})));
|
||||
|
||||
describe('clearCacheFor', () => {
|
||||
it('should support changing the content of a template referenced via templateUrl',
|
||||
|
Reference in New Issue
Block a user