Revert "Support selecting options by their values (Alex Lang)"
This reverts commit 1b51de8f0f
.
Conflicts:
History.txt
This commit is contained in:
parent
d62d135777
commit
461a77d1d9
|
@ -12,8 +12,7 @@
|
||||||
* Minor enhancements
|
* Minor enhancements
|
||||||
|
|
||||||
* Add Webrat.root method for cross-framework support (Krzysztof Zylawy)
|
* Add Webrat.root method for cross-framework support (Krzysztof Zylawy)
|
||||||
* Support selecting options by their values (Alex Lang)
|
* Add support for clicking areas of an image map (Alex Lang)
|
||||||
* Support for clicking areas of an image map (Alex Lang)
|
|
||||||
* Add should_see and should_not_see for verifying HTML response bodys
|
* Add should_see and should_not_see for verifying HTML response bodys
|
||||||
* Support relative links, including href="?foo=bar" (Kyle Hargraves)
|
* Support relative links, including href="?foo=bar" (Kyle Hargraves)
|
||||||
* Separated Rails-specific code from the Webrat core to make it easier to use Webrat with other environments
|
* Separated Rails-specific code from the Webrat core to make it easier to use Webrat with other environments
|
||||||
|
|
|
@ -31,11 +31,11 @@ module Webrat
|
||||||
end
|
end
|
||||||
|
|
||||||
def matches_id?(id)
|
def matches_id?(id)
|
||||||
matches?(self.id, id)
|
@element["id"] == id.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def matches_name?(name)
|
def matches_name?(name)
|
||||||
matches?(self.name, name)
|
@element["name"] == name.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def matches_label?(label_text)
|
def matches_label?(label_text)
|
||||||
|
@ -70,14 +70,6 @@ module Webrat
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def matches?(string, string_or_regex)
|
|
||||||
if string_or_regex.is_a?(Regexp)
|
|
||||||
string_or_regex.match string
|
|
||||||
else
|
|
||||||
string == string_or_regex
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def id
|
def id
|
||||||
@element["id"]
|
@element["id"]
|
||||||
end
|
end
|
||||||
|
@ -308,7 +300,7 @@ module Webrat
|
||||||
class SelectField < Field
|
class SelectField < Field
|
||||||
|
|
||||||
def find_option(text)
|
def find_option(text)
|
||||||
options.detect { |o| o.matches_text?(text) || o.matches_value?(text)}
|
options.detect { |o| o.matches_text?(text) }
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -14,10 +14,6 @@ module Webrat
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def matches_value?(value)
|
|
||||||
@element.attributes['value'] == value.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
def choose
|
def choose
|
||||||
@select.raise_error_if_disabled
|
@select.raise_error_if_disabled
|
||||||
@select.set(value)
|
@select.set(value)
|
||||||
|
|
|
@ -108,18 +108,6 @@ describe "selects" do
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should send value from option in list specified by value" do
|
|
||||||
@session.response_body = <<-EOS
|
|
||||||
<form method="post" action="/login">
|
|
||||||
<select name="start_month"><option value="s1">January</option></select>
|
|
||||||
<input type="submit" />
|
|
||||||
</form>
|
|
||||||
EOS
|
|
||||||
@session.should_receive(:post).with("/login", "start_month" => "s1")
|
|
||||||
@session.selects "s1", :from => "start_month"
|
|
||||||
@session.clicks_button
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should send value from option in list specified by label" do
|
it "should send value from option in list specified by label" do
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<form method="post" action="/login">
|
<form method="post" action="/login">
|
||||||
|
|
Loading…
Reference in New Issue