mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
feat(core): introduce TestBed.tick() (#60993)
This commit introduces the `TestBed.tick()` method that, similarly to the `ApplicationRef.tick()`, synchronizes state with the DOM. It can be used in unit tests to mimic framework's logic executed in production applications. The `TestBed.tick()` should be used instead of the removed `TestBed.flushEffects()`. BREAKING CHANGE: the `TestBed.flushEffects()` was removed - use the `TestBed.tick()` instead. PR Close #60993
This commit is contained in:
committed by
Kristiyan Kostadinov
parent
ccc5cc068f
commit
d5fd7349fb
@@ -152,13 +152,6 @@ export interface TestBed {
|
||||
|
||||
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||
|
||||
/**
|
||||
* Execute any pending effects.
|
||||
*
|
||||
* @deprecated use `TestBed.tick()` instead
|
||||
*/
|
||||
flushEffects(): void;
|
||||
|
||||
/**
|
||||
* Execute any pending work required to synchronize model to the UI.
|
||||
*
|
||||
@@ -398,10 +391,6 @@ export class TestBedImpl implements TestBed {
|
||||
return TestBedImpl.INSTANCE.ngModule;
|
||||
}
|
||||
|
||||
static flushEffects(): void {
|
||||
return TestBedImpl.INSTANCE.flushEffects();
|
||||
}
|
||||
|
||||
static tick(): void {
|
||||
return TestBedImpl.INSTANCE.tick();
|
||||
}
|
||||
@@ -812,15 +801,6 @@ export class TestBedImpl implements TestBed {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute any pending effects.
|
||||
*
|
||||
* @deprecated use `TestBed.tick()` instead
|
||||
*/
|
||||
flushEffects(): void {
|
||||
this.inject(EffectScheduler).flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute any pending work required to synchronize model to the UI.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user