Fix bug with empty select list
This commit is contained in:
parent
275611a0a3
commit
f9ff509f02
@ -237,6 +237,7 @@ module Webrat
|
||||
selected_options = @element / "option[@selected='selected']"
|
||||
selected_options = @element / "option:first" if selected_options.empty?
|
||||
selected_options.map do |option|
|
||||
return "" if option.nil?
|
||||
option["value"] || option.innerHTML
|
||||
end
|
||||
end
|
||||
|
@ -57,6 +57,17 @@ class SelectsTest < Test::Unit::TestCase
|
||||
@session.clicks_button
|
||||
end
|
||||
|
||||
def test_should_work_with_empty_select_lists
|
||||
@response.stubs(:body).returns(<<-EOS)
|
||||
<form method="post" action="/login">
|
||||
<select name="month"></select>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
EOS
|
||||
@session.expects(:post_via_redirect).with("/login", 'month' => '')
|
||||
@session.clicks_button
|
||||
end
|
||||
|
||||
def test_should_work_without_specifying_the_field_name_or_label
|
||||
@response.stubs(:body).returns(<<-EOS)
|
||||
<form method="post" action="/login">
|
||||
|
Loading…
Reference in New Issue
Block a user