New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(core/testing) flush() not working when requestAnimationFrame contexts #43875
Comments
I believe this is by design: angular/packages/zone.js/lib/zone-spec/fake-async-test.ts Lines 283 to 288 in aaf9b31
If you want to cause non-timer macrotasks to resolve then you can do |
Oh, I see... I guess users don't know that you need to use |
You are correct that the API docs do not mention this aspect. By the way do you have to do |
In order for rAF to pass the test, tick(16) is essential, not tick(). I believe this is because rAF is executed 60 times per second (i.e. it takes 16.66ms). (If I could, I would like to see an API that can solve asynchronous processing without relying on such magic-numbers.) |
So it is the case that when you request an animation frame from within angular/packages/zone.js/lib/zone-spec/fake-async-test.ts Lines 610 to 617 in 9f40d2a
Further since rAF are treated diifferently to |
I think this is a bug, since the current logic is not consistent and not good for performance either. |
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
The
requestAnimationFrame
is one of the same macrotasks assetTimeout
, but it is not drained by theflush()
function.Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/node-qvczbt?file=src/app/app.component.spec.ts
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
from stackblitz WebContainer.
Anything else?
Work
tick(16)
, butflush()
should also work.related
The text was updated successfully, but these errors were encountered: