mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08: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:
committed by
Jessica Janiuk
parent
77fa204ad1
commit
bdbf616a4e
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user