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

Are components valid selectors? #82

Open
timswalling opened this issue May 16, 2018 · 0 comments
Open

Are components valid selectors? #82

timswalling opened this issue May 16, 2018 · 0 comments

Comments

@timswalling
Copy link

Firstly, thank you to all the maintainers and contributors who have worked on this - this package makes testing Preact apps so much easier!

I was just wondering if there's there any reason why a component can't be used as a selector for the render context's find method? (find(Selector) or find(ImportedComponent), for example.)

The documentation and types added in #78 only cover nodes, but as far as I can tell this already works: selToWhere(Selector) returns { nodeName: Selector }, and isWhere already handles nodeName values that are functions.

This would make testing in TypeScript easier, as creating a JSX selector without the required props causes type errors, while including the required props can make the test overly specific.

Happy to open a PR to add tests and update the types if that's all that's required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant