Open scottybollinger opened 6 years ago
I'm having the same problem. This is what i have in my package.json
"react-select2-wrapper": "^1.0.4-beta5"
. Any solution?
I'm also having the same issue with the latest 1.0.4-beta6
when mounting a component in a Jest unit test. I'm using Enzyme as well.
TypeError: this.el.select2 is not a function
at Select2.initSelect2 (node_modules/react-select2-wrapper/lib/components/Select2.js:94:15)
at Select2.componentDidMount (node_modules/react-select2-wrapper/lib/components/Select2.js:64:12)
i only got this error when using jest + enzyme
@rkit any help you could provide here? I've spent a week trying to figure this out, building mocks for select2, importing jquery in different places, etc. This is the only issue preventing me from using your library.
solved by adding this
global.$ = require('jquery')
global.$.fn.select2 = require('select2')
on jest setup file
Thank you @agungyuliaji, you're a lifesaver!
Glad to hear that! anyway it's jest problem. the issue is not related with this plugin.
the issue was resolved for me when I added global.$ = require('jquery') global.$.fn.select2 = require('select2') to app.js
Thanks @agungyuliaji
@rkit this can be closed.
https://github.com/rkit/react-select2-wrapper/issues/36 is still happening with the latest version
1.0.4-beta
.TypeError: this.el.select2 is not a function
when mounting a component in a Jest unit test.