diff --git a/tests/javascripts/support/helpers.js b/tests/javascripts/support/helpers.js index 5d3df2c22..9e859e44a 100644 --- a/tests/javascripts/support/helpers.js +++ b/tests/javascripts/support/helpers.js @@ -228,6 +228,7 @@ class WindowMock { }; this._jest = jest; this._setSpies(); + this._plugJSDOM(); } get top () { @@ -260,6 +261,27 @@ class WindowMock { } + _plugJSDOM () { + + const self = this; + + // JSDOM doesn't support .scrollTo + window.scrollTo = function () { + let y; + + // data sent as props in an object + if (arguments.length === 1) { + y = arguments[0].y; + } else { + y = arguments[1]; + } + + self.scrollTo(y); + + }; + + } + setHeightTo (height) { window.innerHeight = height;