title: Vue jest $refs function and component mocking issue
body: <p>I'm using a node module called headroom for one of my vue components. I'm trying to mock the library and write the test but i'm getting a <code>this.$refs.headroom._setHeightOffset is not a function</code> it seems like the function in the $ref isn't defined.</p>
  <p><strong>Vue Component</strong></p>
  <pre><code>&lt;script&gt;
    import { headroom } from 'vue-headroom';
  
    name: 'Test',
  
    components: {
      headroom    
    },
  
    mounted() {
      this.$refs.headroom._setHeightOffset();
    }
  &lt;/script&gt;
  
  &lt;template&gt;
   &lt;headroom ref=&quot;headroom&quot;&gt;
     &lt;OtherComponent /&gt;
    &lt;headroom&gt;
  &lt;/template&gt;
  </code></pre>
  <p>In my test file I'm doing a shallowMount and mocking the imported library like below but it still isn't picking up the function in my test.</p>
  <pre><code>jest.mock('vue-headroom', () =&gt; ({
    name: 'headroom',
    headroom: {
      _setHeightOffset: jest.fn(),
    },
  }));
  </code></pre>
  <p>I tried mocking it like this as well but still didn't work.
  <code>wrapper.vm.$refs.headroom._setHeightOffset =  jest.fn();</code></p>