title: Mocking document.querySelector in Jest
body: <p>I tried mocking this function but not full covered. I am unsure how can I mock <code>getBoundingClientRect</code> in <code>header</code> and <code>dataHeader</code>.</p>
  
  <pre class="lang-js prettyprint-override"><code>handleWindowScroll() {
  
      const header = document.querySelector('.productNavLinksContainer');
      const dataHeader = document.querySelector('.productNavDataContainer');
      if (header &amp;&amp; dataHeader) {
          const headerPos = header.getBoundingClientRect();
          const dataHeaderPos = dataHeader.getBoundingClientRect();
          const sticky = header.offsetTop;
          if (dataHeaderPos.top &gt; headerPos.height) {
              this.setState({
                  sticky: false
              });
          } else if (window.pageYOffset &gt; sticky) {
              this.setState({
                  sticky: true
              });
          }
      } else {
          return;
      }
  }
  </code></pre>