Support '&' in submitted values
This commit is contained in:
parent
e6aff6d37c
commit
3b72459298
|
@ -43,7 +43,8 @@ module Webrat
|
|||
end
|
||||
|
||||
def to_param
|
||||
param_parser.parse_query_parameters("#{name}=#{@value}")
|
||||
value = @value.to_s.gsub('&', '%26')
|
||||
param_parser.parse_query_parameters("#{name}=#{value}")
|
||||
end
|
||||
|
||||
def set(value)
|
||||
|
|
|
@ -48,6 +48,18 @@ describe "selects" do
|
|||
@session.clicks_button
|
||||
end
|
||||
|
||||
it "should send values with HTML encoded ampersands" do
|
||||
@session.response_body = <<-EOS
|
||||
<form method="post" action="/login">
|
||||
<select name="encoded"><option value="A & B">Encoded</option></select>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
EOS
|
||||
@session.expects(:post).with("/login", "encoded" => "A & B")
|
||||
@session.selects "Encoded", :from => "encoded"
|
||||
@session.clicks_button
|
||||
end
|
||||
|
||||
it "should work with empty select lists" do
|
||||
@session.response_body = <<-EOS
|
||||
<form method="post" action="/login">
|
||||
|
|
Loading…
Reference in New Issue