fixture.detectChanges() leads to unresolvable Problem in fakeAsync zone
See original GitHub issueAngular Version: 12
“ngx-quill”: “^14.3.0”, “quill”: “^1.3.7”,
The problem is pretty easy to reproduce. Create a test component containing any quill instance.
Then if you do
beforeEach(() => {
fixture.detectChanges()
})
everything works fine.
However if you do:
beforeEach(fakeAsync(() => {
fixture.detectChanges();
});
it will always fail with a timer still in queue
problem.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Does fixture.whenStable() actually do anything in my angular ...
detectChanges . My question is regarding what fixture.whenstable will do when inside of a FakeAsync execution zone as an Async zone should keep ......
Read more >Unit test within async using fixture.detectChanges() fails #89
Hello,. This is the issue description: Using the method from ComponentFixture . detectChanges() is failing when you use it within an async() ...
Read more >Testing Asynchronous Operations in Angular Components
Calling fixture.detectChanges() tells Angular to run change-detection. ... fakeAsync wraps your test function in the fakeAsync Zone.
Read more >Testing - ts - GUIDE - Angular
But a direct, synchronous update of the component property is invisible. The test must call fixture.detectChanges() manually to trigger another cycle of change ......
Read more >Testing - Angular
But a direct, synchronous update of the component property is invisible. The test must call fixture.detectChanges() manually to trigger another cycle of change ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Unfortunately no. We did do a workaround but it’s pretty “over-engineered” IMO:
Apparently quill/ngx-quill needs
fixture.detectChanges()
to be ran outside of fakeAsync to ensure proper loading.But that also triggers
ngOnInit
. Hence we do this:Strange because I do not have any problems in my unit tests.
There are some with fakeasync as well.
Since this project is growing over years I forget some implementation details 😃.
I knew that there is an optional debounce timer for change detection in the editor.
Maybe this debouncing is running and you need to add a tick() with some milliseconds as Parameter.
David Lorenz @.***> schrieb am Do., 25. Nov. 2021, 08:50: