Merge branch 'master' of git://github.com/nevans/webrat into nevans/master
This commit is contained in:
commit
d304564283
|
@ -55,10 +55,15 @@ module Webrat
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
|
return nil if disabled?
|
||||||
value = @value.to_s.gsub('&', '%26')
|
value = @value.to_s.gsub('&', '%26')
|
||||||
param_parser.parse_query_parameters("#{name}=#{value}")
|
param_parser.parse_query_parameters("#{name}=#{value}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def disabled?
|
||||||
|
@element.attributes.has_key? "disabled"
|
||||||
|
end
|
||||||
|
|
||||||
def set(value)
|
def set(value)
|
||||||
@value = value
|
@value = value
|
||||||
end
|
end
|
||||||
|
|
|
@ -165,6 +165,21 @@ describe "clicks_button" do
|
||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should not send disabled field values" do
|
||||||
|
@session.response_body = <<-EOS
|
||||||
|
<form method="get" action="/login">
|
||||||
|
<input disabled id="user_email" name="user[email]" value="test@example.com" type="text" />
|
||||||
|
<input disabled id="user_gender_male" name="user[gender]" type="radio" value="M" />
|
||||||
|
<label for="user_gender_male">Male</label>
|
||||||
|
<input disabled id="user_gender_female" name="user[gender]" type="radio" value="F" checked="checked" />
|
||||||
|
<label for="user_gender_female">Female</label>
|
||||||
|
<input type="submit" />
|
||||||
|
</form>
|
||||||
|
EOS
|
||||||
|
@session.should_receive(:get).with("/login", {})
|
||||||
|
@session.clicks_button
|
||||||
|
end
|
||||||
|
|
||||||
it "should send default checked fields" do
|
it "should send default checked fields" do
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<form method="get" action="/login">
|
<form method="get" action="/login">
|
||||||
|
|
Loading…
Reference in New Issue