enzyme icon indicating copy to clipboard operation
enzyme copied to clipboard

Support for ::after pseudo-element

Open k-vosswinkel opened this issue 7 years ago • 4 comments

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.

k-vosswinkel avatar Apr 16 '19 16:04 k-vosswinkel

I would like to work on this feature, though I don’t know if it’s 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 avatar Apr 18 '19 14:04 Jotakuun

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

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

ljharb avatar Apr 18 '19 15:04 ljharb

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.

Jotakuun avatar Apr 19 '19 07:04 Jotakuun

any updates on this?

oliviam20 avatar Jun 11 '19 02:06 oliviam20