UNPKG

mock-request-animation-frame

Version:
1 lines 2.02 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(()=>(()=>{"use strict";var e={607:function(e,t,o){var n=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),i=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||t.hasOwnProperty(o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),i(o(3),t),i(o(892),t)},3:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockClientWindow=void 0;const o={height:1e3,width:1e3};t.mockClientWindow=e=>{const t=Object.assign(Object.assign({},o),e);let n,i;beforeEach((function(){n=jest.spyOn(window.HTMLElement.prototype,"clientWidth","get").mockImplementation((()=>t.width)),i=jest.spyOn(window.HTMLElement.prototype,"clientHeight","get").mockImplementation((()=>t.height)),jest.useFakeTimers()})),afterEach((()=>{n.mockReset(),i.mockReset(),jest.runAllTimers()}))}},892:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.mockRequestAnimationFrame=void 0,t.mockRequestAnimationFrame=function(){let e,t;beforeEach((function(){e=jest.spyOn(window.HTMLElement.prototype,"clientWidth","get").mockImplementation((()=>1e3)),t=jest.spyOn(window.HTMLElement.prototype,"clientHeight","get").mockImplementation((()=>1e3)),window.HTMLElement.prototype.scrollIntoView=jest.fn(),jest.spyOn(window,"requestAnimationFrame").mockImplementation((e=>setTimeout(e,0))),jest.spyOn(window.screen,"width","get").mockImplementation((()=>1024)),jest.useFakeTimers()})),afterEach((()=>{jest.runAllTimers(),e.mockReset(),t.mockReset()})),afterAll((function(){jest.useRealTimers()}))}}},t={};return function o(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={exports:{}};return e[n].call(r.exports,r,r.exports,o),r.exports}(607)})()));