title: Use Scroll and Width in JSDOM
body: <p>I am trying to write a test case for a component which checks if a function bound to a component is called if scroll is triggered on window object.This is <strong>not using react framework</strong> although I am using JEST as my testing framework which uses JSDOM since it is very good and fast.</p>
  
  <p>The first problem is the scroll is not getting triggered at all. Read about it in a lot of github issues but had no luck.</p>
  
  <p>The second problem is that I have set a width to one of the elements to 1000 px which is a sandbox element in jsdom using jest. But when I add another element below it which is the result of the rendered component the DOMElement function of getClientBoundingRect still returns all zeros.</p>
  
  <p>I tried a couple of things which did not work:</p>
  
  <ol>
  <li><p><code>global.document.dispatch(new Event('scroll'))</code> (this was done after adjusting the scroll position)</p></li>
  <li><p>After rendering my component which has around 19 <code>li</code> elements in it (each li element has a 10x10 px image and a title), I am trying to check the height of my component to scroll to that position, but unfortunately everything is coming to 0. </p></li>
  </ol>
  
  <p>Is there any other way to test or cover a function which is called on <code>window.scroll</code> using jsdom/jest, I don't want to use phantomjs.</p>