Documentation on using chai-enzyme with jquery-chai
Opened this issue · 3 comments
Great project. I have a question on how to configure chai to allow the use of both chai-enzyme and jquery-chai side-by-side. Any help would be appreciated.
@bassettsj What exactly are you trying to achieve by using chai-jquery?
Is it because you want to be able to do jQuery style selectors when testing shallow render results?
In any case chai-jquery will not be compatible with chai-enzyme, because chai-jquery uses the actual DOM where-as chai-enzyme uses shallow rendering and virtual dom.
When mounting React components Enzyme uses cheerio underneath the service which also gives you jQuery style selectors, it doesn't expose it though.
I am not trying to use jquery-chai when testing react components at all, we have been using jquery-chai for testing our old backbone based views. It is more that we want to able to to test our new react based components using chai-enzyme in the same test setup. That is all.
"It's important to know that all assertions are registered with Chai's overwrite* methods and therefore this plugin can work next to other Chai.js plugins that have similar assertions, such as chai-jquery."