Enzyme: Support for ::after pseudo-element

Created on 16 Apr 2019  路  4Comments  路  Source: enzymejs/enzyme

Support for ::before and ::after pseudo-elements would be amazing!

Was reading up on current support for pseudo-selectors and taking a look at https://github.com/airbnb/enzyme/pull/1537, and supporting ::before and ::after would be much appreciated.

mount shallow feature request help wanted

Most helpful comment

Thanks for clarifying, I will leave it to someone who can handle it better than me. Though I'll be subscribed to this feature request to see how it would be implemented.

Let me know if I could be of any help.

All 4 comments

I would like to work on this feature, though I don鈥檛 know if it鈥檚 a good starting point for a first pull request to Enzyme. What do they maintainers think about this?

At first sight, I thought it was just updating the matchPseudoSelector() in selector.js to handle before/after pseudo-elements and return the corresponding node. But I didn't have in mind how to test this feature, because a DOM element cannot be mounted with a pseudo-selector as inline style, any suggestion on how to do this?

@Jotakuun anything with string selectors isn鈥檛 likely a good first PR, because it probably requires changes in another package, rst-selector-parser.

As for how to test it, that鈥檚 a good question; we鈥檇 need to test for it in both shallow and mount, which means, both with and without a dom.

Thanks for clarifying, I will leave it to someone who can handle it better than me. Though I'll be subscribed to this feature request to see how it would be implemented.

Let me know if I could be of any help.

any updates on this?

Was this page helpful?
0 / 5 - 0 ratings