@polesye Removed all occurrence of ".focus).toHaveBeenCalled();" and replaced them by ".toBeFocused()" matcher. Removed unnecessary spy: "spyOn($.fn, 'focus');"