ResizeObserver (and MutationObserver) not patched by zone.js
See original GitHub issueCurrent behavior
Example with delay (my use case) - https://stackblitz.com/edit/angular-f8evbx?file=src/app/app.component.spec.ts Simplified example - https://stackblitz.com/edit/angular-f8evbx-3ak8vv?file=src/app/app.component.spec.ts MutationObserver example - https://stackblitz.com/edit/angular-f8evbx-6wdpmj?file=src/app/app.component.ts
- Use ResizeObserver (or MutationObserver + window.onresize to polyfill) on an element
- (not relevant) Handle event into an observable with debouce or some other delay thingy
- Write test for it using fakeAsync
Tests using fakeAsync fail, I’m forced to use setTimeout(expectations+done, delay)
which causes unexpected delays. I tried using import 'zone.js/dist/zone-patch-resize-observer';
but it didn’t work.
On top of that, the timeout is flaky unless a full extra second or so is added to the delay.
Expected behavior
flush()
should trigger events from ResizeObserver
and MutationObserver
Other things
“zone.js”: “^0.8.26” “@angular/core”: “^6.1.0”, “rxjs”: “^6.2.0”,
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:27 (9 by maintainers)
Top GitHub Comments
Any progress?
ResizeObserver
is an available polyfill.MutationObserver
is already automatically patched.