Git Product home page Git Product logo

Comments (9)

agungyuliaji avatar agungyuliaji commented on September 13, 2024 2

solved by adding this

global.$ = require('jquery')
global.$.fn.select2 = require('select2')

on jest setup file

from react-select2-wrapper.

agungyuliaji avatar agungyuliaji commented on September 13, 2024 1

Glad to hear that!
anyway it's jest problem. the issue is not related with this plugin.

from react-select2-wrapper.

Dcuevac93 avatar Dcuevac93 commented on September 13, 2024

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.

CWSites avatar CWSites commented on September 13, 2024

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.

agungyuliaji avatar agungyuliaji commented on September 13, 2024

i only got this error when using jest + enzyme

from react-select2-wrapper.

CWSites avatar CWSites commented on September 13, 2024

@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.

CWSites avatar CWSites commented on September 13, 2024

Thank you @agungyuliaji, you're a lifesaver!

from react-select2-wrapper.

syedn avatar syedn commented on September 13, 2024

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.

CWSites avatar CWSites commented on September 13, 2024

@rkit this can be closed.

from react-select2-wrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.