mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): Deprecate fixture.autoDetectChanges(true/false) (#61429)
After nearly a decade of existence, there are 0 uses of `autoDetectChanges(false)` internally. All uses of `autoDetectChanges(true)` can be migrated directly to `autoDetectChanges()` instead. PR Close #61429
This commit is contained in:
parent
77fa204ad1
commit
bdbf616a4e
2 changed files with 12 additions and 1 deletions
|
|
@ -11,7 +11,9 @@ import { Subscription } from 'rxjs';
|
|||
// @public
|
||||
export class ComponentFixture<T> {
|
||||
constructor(componentRef: ComponentRef<T>);
|
||||
autoDetectChanges(autoDetect?: boolean): void;
|
||||
// @deprecated
|
||||
autoDetectChanges(autoDetect: boolean): void;
|
||||
autoDetectChanges(): void;
|
||||
changeDetectorRef: ChangeDetectorRef;
|
||||
checkNoChanges(): void;
|
||||
componentInstance: T;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,16 @@ export class ComponentFixture<T> {
|
|||
* Also runs detectChanges once so that any existing change is detected.
|
||||
*
|
||||
* @param autoDetect Whether to autodetect changes. By default, `true`.
|
||||
* @deprecated For `autoDetect: true`, use `autoDetectChanges()`.
|
||||
* We have not seen a use-case for `autoDetect: false` but `changeDetectorRef.detach()` is a close equivalent.
|
||||
*/
|
||||
autoDetectChanges(autoDetect: boolean): void;
|
||||
/**
|
||||
* Enables automatically synchronizing the view, as it would in an application.
|
||||
*
|
||||
* Also runs detectChanges once so that any existing change is detected.
|
||||
*/
|
||||
autoDetectChanges(): void;
|
||||
autoDetectChanges(autoDetect = true): void {
|
||||
if (this._noZoneOptionIsSet && !this.zonelessEnabled) {
|
||||
throw new Error('Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set.');
|
||||
|
|
|
|||
Loading…
Reference in a new issue