jeudi 16 janvier 2020

Angular 9 - Karma - spyon on window.scroll polymorphism

I have a problem in Angular 9 ( in angular 7, i haven't this problem ). In my test, i have this :

const spyWindoScroll = spyOn(window, 'scroll');

...

expect(spyWindoScroll).toHaveBeenCalledWith({ behavior: 'smooth', left: 0, top: -50 });

But when i launch ng test, i have this error :

error TS2554: Expected 2 arguments, but got 1.

I don't understand because window.scroll have two definition for method scroll

interface Window extends ...
...
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;

...

Any idea to resolve this problem ?

Thanks

Aucun commentaire:

Enregistrer un commentaire