Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Uncaught [TypeError: Cannot read property 'addEventListener' of null] thrown when using component in tests #252

Open
alex-akanthas opened this issue Jul 25, 2023 · 1 comment

Comments

@alex-akanthas
Copy link

Reopening #78

@srigar I'm still getting this error with version 2.0.25 and jest

/**
 * @jest-environment jsdom
 */

import renderer from 'react-test-renderer';
import { Multiselect } from 'multiselect-react-dropdown';
 
it('multiselect renders', () => {
    let state = {
        options: [{name: 'Option 1', id: 1},{name: 'Option 2', id: 2}]
    };
    

 
  const tree = renderer
    .create(<Multiselect
            options={state.options} // Options to display in the dropdown
            displayValue="name" // Property name to display in the dropdown options
      />
)
    .toJSON();
  expect(tree).toMatchSnapshot();
});

Any help would be much appreciated. The component itself works great with some nice fixes being observed after we upgraded from 1.6 to 2.0.25 :-)

@alex-akanthas
Copy link
Author

And please let me know if I have done something wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant