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

bug fix: getSeletors() #427

Merged
merged 6 commits into from
Jun 6, 2016
Merged

bug fix: getSeletors() #427

merged 6 commits into from
Jun 6, 2016

Conversation

rifeljm
Copy link
Contributor

@rifeljm rifeljm commented May 30, 2016

selectors shouldn't be split by space, because selector itself can contain a space
Example: .find('div[data-foo="foo bar"]')

selectors shouldn't be split by space, because selector itself can contain a space
Example: .find('div[data-foo="foo bar"]')
<h1 data-foo="foo bar">Hello</h1>
</div>
);
expect(wrapper.find('[data-foo="foo bar"]')).to.have.length(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add another test to verify that attribute queries still work without the attribute value?

wrapper.find("[data-foo]")

@aweary
Copy link
Collaborator

aweary commented Jun 1, 2016

@rifeljm can we make sure this works with/covers the following cases as well:

  • Attribute values with multiple words ('[data-foo="bar baz quz"]')
  • Attribute values with multiple spaces between the words ('data-foo="bar baz quz')

^ The spaces don't show in the example, but they're there 😄

- selectors shouldn't be cleaned of multiple spaces
- added few more tests
@aweary
Copy link
Collaborator

aweary commented Jun 1, 2016

@rifeljm can you update the branch with master? After that I think we can merge 👍

@blainekasten
Copy link
Contributor

LGTM

@blainekasten blainekasten merged commit 2914948 into enzymejs:master Jun 6, 2016
@blainekasten
Copy link
Contributor

Thanks @rifeljm

islemaster added a commit to islemaster/enzyme that referenced this pull request Aug 4, 2016
Support for spaces in attribute selector values was added in 2.4.0 ([PR enzymejs#427](enzymejs#427)) but was not documented in the changelog.  It took me a while to sort out why my selectors `option[value="by Alice"]` were working in 2.4.1 but not 2.3.0 ([see my gradual realization here](code-dot-org/code-dot-org#9830)).  I'm recommending this get added to the changelog to save others some time.
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