What I understand is that ":not" is a css selector to find an element without specified attribute.
So, with this component:
const Table = () => (
<table>
<thead>
<tr>
<th></th>
<th></th>
<tr>
</thead>
<tbody>
<tr>
<th scope="row"></th>
<td></td>
<tr>
</tbody>
</table>
);
But why this is happening?
wrapper.find('th[scope="row"]').length // == 1
wrapper.find('th:not([scope="row"])').length // == 0 ?
You can see enzyme is supporting CSS selectors in the following.
https://github.com/airbnb/enzyme/blob/master/docs/api/selector.md#1-a-valid-css-selector
We'd gladly accept a PR if you were wanting to add support for the :not selector!
I'm giving it a try, I'll ley you know soon of my progress!
I've sent the pull request. Can you check it?
This was added in #460.
Looks like the PR referenced above ended up getting closed rather than merged.
For anyone else ending up here from Google, here's the documentation for the implemented solution:
https://airbnb.io/enzyme/docs/api/ShallowWrapper/not.html
@akegan it ended up moving to #1086, and should be in all versions of enzyme 3.
Most helpful comment
You can see enzyme is supporting CSS selectors in the following.
https://github.com/airbnb/enzyme/blob/master/docs/api/selector.md#1-a-valid-css-selector