title: Cannot read property 'selectionEnd' of null using React + Jest + Datepicker + TextMask
body: <p>I had a unit test that was working, but now I added a new package to my <code>react-datepicker</code>, called <code>react-text-mask</code> and I tried to mock it, but it receive the following message when I run <code>npm run test</code>:</p>
  <blockquote>
  <p>TypeError: Cannot read property 'selectionEnd' of null</p>
  <p>at Object.update (node_modules/react-text-mask/dist/reactTextMask.js:1:9205)</p>
  <p>at t.value (node_modules/react-text-mask/dist/reactTextMask.js:1:2431)</p>
  <p>at t.value (node_modules/react-text-mask/dist/reactTextMask.js:1:2490)</p>
  <p>at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6427:22)</p>
  <p>at commitAllLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7516:7)</p>
  </blockquote>
  <p>My <code>react-datepicker</code> with <code>react-text-mask</code>:</p>
  <pre><code>&lt;RCDatePicker
          {...rest}
          locale=&quot;pt-BR&quot;
          selected={value}
          onChange={onChange}
          readOnly={readOnly}
          dateFormat={dateFormat}
          minDate={minDays ? moment(baseDate).subtract(minDays, 'days') : undefined}
          maxDate={maxDays ? moment(baseDate).add(maxDays, 'days') : undefined}
          disabled={disabled}
          customInput={&lt;MaskedInput
            mask={[/[0-3]/, /\d/, '/', /[0-1]/, /\d/, '/', /[1-2]/, /\d/, /\d/, /\d/]}
          /&gt;}
        &gt;
  </code></pre>
  <p>My unit test:</p>
  <pre><code>describe('&lt;DatePicker /&gt;', () =&gt; {
    it('should have default props', () =&gt; {
      const mock = jest.mock('react-text-mask', () =&gt; props =&gt; &lt;input type=&quot;text&quot; {...{ ...props }} /&gt;);
      const tree = renderer.create(&lt;DatePicker onChange={Function} /&gt;).toJSON()
      jest.spyOn(mock)
  
      expect(tree).toMatchSnapshot()
    })
  })
  </code></pre>