Understand the Different Accepted Selectors in Enzyme

Share this video with your friends

Send Tweet

Many of the methods used in Enzyme’s API accept a selector as an argument. In this lesson we will go over the valid CSS, prop, object property, component displayName, and component constructor selectors that can be used as method arguments.

Patrik Affentranger
Patrik Affentranger
~ 7 years ago

What about finding an actual React component:

wrapper.find(App) instead of wrapper.find('App')?

David Chan
David Chan
~ 6 years ago

What about finding an actual React component:

wrapper.find(App) instead of wrapper.find('App')?

I think you can do that, here is the doc, https://github.com/airbnb/enzyme/blob/master/docs/api/selector.md#3-a-react-component-constructor

Bress B
Bress B
~ 5 years ago

At 1:12 what is the relationship between the selector and the test? In other words, what is being tested? It would have been helpful is Tyler had actually completed the tests