feat(core): introduce TestBed.tick()#60993
feat(core): introduce TestBed.tick()#60993pkozlowski-opensource wants to merge 1 commit intoangular:mainfrom
Conversation
b9146de to
c725df5
Compare
|
This is currently blocked on the pending G3 cleanup |
c725df5 to
23856b1
Compare
|
Will this work without zone.js? |
|
Does it synchronize state with the DOM, or does it ask Angular to synchronize state with the DOM if and only if Angular thinks it should do it, the same way as it would decide in production, i.e. if it detects that an event listener has been executed, or that a signal read by a template has changed? Documenting this would be so helpful. There are so many ways to do similar but slightly different things: |
|
G3 cleanup is done, this PR is ready for review. |
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.
23856b1 to
0a91db9
Compare
@e-oz yes
@jnizet agreed. This change is more about getting rid of |
|
Thanks @pkozlowski-opensource . I hope this streamlining comes soon! |
|
caretaker note: I did the G3 cleanup and atm there is no new usage of
|
thePunderWoman
left a comment
There was a problem hiding this comment.
reviewed-for: public-api
|
This PR was merged into the repository by commit d5fd734. The changes were merged into the following branches: main |
|
Since this |
|
This is not a fakeAsync |
|
I understand, but since this one is already part of TestBed and will be only used in tests, it would be very handy to replace current usages of |
|
Those are not interchangeable as they do not have the same purpose.
You alternatives are either native async/await or this like the Jasmine.clock with |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This commit introduces the
TestBed.tick()method that, similarly to theApplicationRef.tick(), synchronizes state with the DOM. It can be used in unit tests to mimic framework's logic executed in production applications. TheTestBed.tick()should be used instead of the removedTestBed.flushEffects().BREAKING CHANGE: the
TestBed.flushEffects()was removed - use theTestBed.tick()instead.