angular / zone.js

Implements Zones for JavaScript
https://github.com/angular/angular/tree/master/packages/zone.js/
MIT License
3.25k stars 407 forks source link

fakeAsync patch for requestAnimationFrame is not passing the timestamp #1216

Closed santialbo closed 5 years ago

santialbo commented 5 years ago

When requestAnimationFrame is patched in fakeAsync the callback is not called with a timestamp like it would be expected. Instead it's called with the callback itself.

  it('should patch requestAnimationFrame correctly', fakeAsync(() => {
    requestAnimationFrame((timestamp) => {
      // Fails: Expected 'function' to be 'number'.
      expect(typeof timestamp).toBe('number');
    });
    tick(16);
  }));

I created this repo with the failing test https://github.com/santialbo/raf-zonejs-test/blob/4491d675287b2513e39244a368877bb951b19248/src/app/app.component.spec.ts#L32-L38 It's a standard cli generated project with just the failing test

JiaLiPassion commented 5 years ago

I will check it, thanks

JiaLiPassion commented 5 years ago

@santialbo, thank you, this is a bug, I have fixed it in #1220

santialbo-actimo commented 5 years ago

Thank you so much!! do you have any idea when the next release of zone.js will be?

JiaLiPassion commented 5 years ago

@santialbo-actimo, I am not sure, but I think it will be released soon.