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

Id selector not working when combined with a tag selector #314

Closed
rouanw opened this issue Apr 11, 2016 · 4 comments
Closed

Id selector not working when combined with a tag selector #314

rouanw opened this issue Apr 11, 2016 · 4 comments

Comments

@rouanw
Copy link

rouanw commented Apr 11, 2016

I've been trying to get the following unit test code to work:

const component = React.createElement(MyComponent, { });
const wrapper = shallow(component);
expect(wrapper.find('input#myid').length).to.equal(1);

But the find method is not finding anything. It is able to find the input box just fine with input as the selector and with #myid as the selector, but not when I specify both.

I'm using Enzyme v2.2.0.

@blainekasten
Copy link
Contributor

FWIW, using id's is an anti-pattern in react since it breaks re-usability with w3c DOM validation.
That said, this does appear to a be a bug.

cc @lelandrichardson

@rouanw
Copy link
Author

rouanw commented Apr 15, 2016

Thanks @blainekasten.

@havenchyk
Copy link

The fix is merged two months ago, can it be closed?

@aweary
Copy link
Collaborator

aweary commented Jun 17, 2016

@havenchyk yupp, thanks!

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

No branches or pull requests

4 participants