Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New]: selectors: support universal selector #1945

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

chenesan
Copy link
Contributor

Fix #1158 .

Note that rst-selector-parser has universal selector support now so we only need to change selectors code in enzyme.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great! Can you add more test cases that combine * with other selector types?

@ljharb ljharb added this to Open in Make string selectors awesome via automation Dec 16, 2018
@ljharb ljharb added the semver: minor New stuff. label Dec 16, 2018
@chenesan
Copy link
Contributor Author

@ljharb added 4 more tests like .top-div ~ * #wrap-div > * and force pushed the commit

docs/api/selector.md Outdated Show resolved Hide resolved
@eps1lon
Copy link
Contributor

eps1lon commented Dec 17, 2018

Does this only select DOM nodes or also components (class or function etc).

@chenesan
Copy link
Contributor Author

chenesan commented Dec 17, 2018

Currently it's only for DOM nodes. Just like other string css selectors.

@eps1lon
Copy link
Contributor

eps1lon commented Dec 17, 2018

Could we add a test to ensure that this is not returning other components? I'm asking because I currently use a helper getter to find the outermost DOM node in a subtree with findWhere and this could potentially replace that.

@ljharb
Copy link
Member

ljharb commented Dec 17, 2018

@chenesan all the selectors in enzyme select on all kinds of nodes, not just DOM nodes.

@ljharb
Copy link
Member

ljharb commented Dec 17, 2018

@eps1lon you may want .hostNodes() to filter out non-DOM nodes

@chenesan
Copy link
Contributor Author

@ljharb Sorry for misleading! I just added one test to show that universal selector also select component node.

@chenesan

This comment has been minimized.

@ljharb ljharb changed the title [Fix]: selectors: support universal selector [New]: selectors: support universal selector Jan 29, 2019
@ljharb

This comment has been minimized.

@chenesan chenesan force-pushed the support_universal_selector branch 3 times, most recently from eee9542 to 11dc5ec Compare January 29, 2019 08:47
@ljharb ljharb merged commit 7bd0bdb into enzymejs:master Jan 29, 2019
Make string selectors awesome automation moved this from Open to Closed/Merged Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants