Closed aberonni closed 7 years ago
I found a way of interacting with the underlying jquery instance, it isn't exactly a clean method of doing this but I guess it is something:
const $select = $(component.find('Select2 select').getDOMNode());
$select.select2('open');
I'm leaving this open just in case someone else has a better way of doing this.
@aberonni how did you integrate the code above with your Jest tests? Did you add it to the setup or was it inside of the component you were trying to mount. Can you post a little more info? I'm running into the same issue.
@CWSites I believe that code was inside the jest test, but I'm relying on my memory. I don't have access to that codebase anymore, sorry.
Thanks anyways @aberonni!
Hi,
I might be doing this wrong, but I'm having a hard time trying to use this inside jest using enzyme's mount to mount my root component. It seems that the Select2 object is not rendered into the DOM when I mount my root component.
This doesn't happen with other components I'm using so I'm not sure whether I'm doing something wrong or rather it is a limitation of this component.
Any help would be greatly appreciated.