#220 awaiting-patch
Luismi Cavallé

Nested have_xpath (or have_selector) doesn't search the whole subtree

Reported by Luismi Cavallé | April 16th, 2009 @ 05:16 AM

If you have the following HTML:

<div>
  <ul>
    <li>wadus</li>
  </ul>
</div>

The following code to test it:

response.should have_selector("div") do |node|
  node.should have_selector("li")
end

The test fails because the li element isn't a direct child of the div element.

I don't know if this is a bug or a feature, but I think is pretty much useful that nested selectors search the whole subtree, not only the root.

This patch make have_xpath (therefore have_selector) work this way:
http://github.com/cavalle/webrat/commit/7810fd27de2b30b2462aa5657cd...

Comments and changes to this ticket

  • gaffo

    gaffo May 7th, 2009 @ 06:59 PM

    • Tag changed from patch to patch, verify
    • State changed from “new” to “awaiting-patch”

    Patch looks good. Just need to verify it.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

Tags

Referenced by

Pages