Comments (9)
solved by adding this
global.$ = require('jquery')
global.$.fn.select2 = require('select2')
on jest setup file
from react-select2-wrapper.
Glad to hear that!
anyway it's jest problem. the issue is not related with this plugin.
from react-select2-wrapper.
I'm having the same problem. This is what i have in my package.json
"react-select2-wrapper": "^1.0.4-beta5"
. Any solution?
from react-select2-wrapper.
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)
from react-select2-wrapper.
i only got this error when using jest + enzyme
from react-select2-wrapper.
@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.
from react-select2-wrapper.
Thank you @agungyuliaji, you're a lifesaver!
from react-select2-wrapper.
the issue was resolved for me when I added
global.$ = require('jquery')
global.$.fn.select2 = require('select2')
to app.js
Thanks @agungyuliaji
from react-select2-wrapper.
@rkit this can be closed.
from react-select2-wrapper.
Related Issues (20)
- Warning: findDOMNode is deprecated in StrictMode
- Cannot read property 'oneOfType' of undefined HOT 1
- react-select2-wrapper not working in modal bootstrap 4
- Support React V18.1.0 HOT 2
- Support React 15.5 +
- Uncaught TypeError: $element.data is not a function HOT 2
- "dropdownParent" not working properly HOT 1
- How to use .map array on data.
- Search not working HOT 1
- Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option> HOT 2
- Missing style while using react Loadable
- Testing: Unable to update value in jest/enzyme tests
- Changing data doesn't cause select2 to update
- Uncaught TypeError: Cannot read property 'oneOfType' of undefined
- react-select2-wrapper is using a deprecated lifecycle hook
- Cannot resolve Jquery HOT 2
- I want to update react states, after getting data from Ajax response, but it is not working.
- There is no option to get an option by default selected and display on placeholder HOT 1
- Add typescript support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-select2-wrapper.