react-input-mask
react-input-mask copied to clipboard
Does not work Jest snapshot testing
Hello, I'm trying to do snapshot testing with Jest and react-test-renderer, but it fails.
I use 3.0.0-alpha.2
code:
import React from 'react';
import renderer from 'react-test-renderer';
import InputMask from 'react-input-mask';
describe("'DateField' component", () => {
it('should render', () => {
const tree = renderer
.create(
<InputMask mask="99.99.9999">
<input />
</InputMask>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
Error:
TypeError: Cannot read property 'addEventListener' of null
6 | it('should render', () => {
7 | const tree = renderer
> 8 | .create(
| ^
9 | <InputMask
10 | // type="text"
11 | // alwaysShowMask
Thanks for your PR @npi3pak, in the meantime I've published a fix on npm =>
npm install -S @iam4x/react-input-mask@^3.0.0-alpha.3
Any progress on a fix? This is still an issue and I am getting an error with react-test-renderer and Storybook7!
TypeError: Cannot read properties of null (reading 'addEventListener')
at node_modules/react-input-mask/lib/react-input-mask.development.js:219:11
...