enzyme: attribute selector returning null when selector contains a dot or space

example:

(wrapper.find('[name="user.first_name"]') returns null.

(wrapper.find('[placeholder="First name"]') returns null.

As far as I’m aware dot syntax is totally acceptable and valid?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@ljharb apologies, upon further investigation it appears my issue is with wrapper.update(). It was just manifesting in a way that appeared to be a selector issue.

Our tests leverage a mock fetch service, so there’s an async aspect to it. I’m leveraging async/await. Oddly, whereas before I could

await form.simulate('submit')
await wrapper.update()

Now, I have to add a second wrapper.update():

await form.simulate('submit')
await wrapper.update()
wrapper.update()

At any rate, you can close this issue out again.

@ljharb it is, rst-selector-parser correctly handles both spaces and dots in attribute values.