Correct problem with partial matches

This commit is contained in:
Jonas Nicklas 2009-12-09 21:53:12 +01:00
parent ac357b8e11
commit ae48b83ded
2 changed files with 5 additions and 3 deletions

View File

@ -84,7 +84,7 @@ module Capybara
def add_field(locator)
xpath = append(yield(s(locator)))
xpath.append(yield("//label[contains(.,#{s(locator)})]/@for"))
xpath = xpath.append(yield("//label[contains(.,#{s(locator)})]/@for"))
xpath.prepend(yield("//label[text()=#{s(locator)}]/@for"))
end

View File

@ -2,8 +2,10 @@
<form action="/form" method="post">
<p>
<label for="form_first_name">First Name</label>
<input type="text" name="form[first_name]" value="John" id="form_first_name"/>
<label for="form_first_name">
First Name
<input type="text" name="form[first_name]" value="John" id="form_first_name"/>
</label>
</p>
<p>