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:
@ -116,30 +116,28 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should mark formGroup as submitted on submit event',
|
||||
inject([TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
|
||||
const t = `<div>
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
const t = `<div>
|
||||
<form #f="ngForm" [formGroup]="form" (ngSubmit)="data=f.submitted"></form>
|
||||
<span>{{data}}</span>
|
||||
</div>`;
|
||||
|
||||
var fixture: ComponentFixture<MyComp8>;
|
||||
var fixture: ComponentFixture<MyComp8>;
|
||||
|
||||
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => {
|
||||
fixture = root;
|
||||
});
|
||||
tick();
|
||||
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => { fixture = root; });
|
||||
tick();
|
||||
|
||||
fixture.debugElement.componentInstance.form = new FormGroup({});
|
||||
fixture.debugElement.componentInstance.data = false;
|
||||
fixture.debugElement.componentInstance.form = new FormGroup({});
|
||||
fixture.debugElement.componentInstance.data = false;
|
||||
|
||||
tick();
|
||||
tick();
|
||||
|
||||
var form = fixture.debugElement.query(By.css('form'));
|
||||
dispatchEvent(form.nativeElement, 'submit');
|
||||
var form = fixture.debugElement.query(By.css('form'));
|
||||
dispatchEvent(form.nativeElement, 'submit');
|
||||
|
||||
tick();
|
||||
expect(fixture.debugElement.componentInstance.data).toEqual(true);
|
||||
})));
|
||||
tick();
|
||||
expect(fixture.debugElement.componentInstance.data).toEqual(true);
|
||||
})));
|
||||
|
||||
it('should work with single controls',
|
||||
inject(
|
||||
|
Reference in New Issue
Block a user