Added RadioField#checked? to indicated whether or not a radio button is checked.
This commit is contained in:
parent
f29cb53239
commit
82b1553719
@ -241,6 +241,10 @@ module Webrat
|
|||||||
set(@element["value"] || "on")
|
set(@element["value"] || "on")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def checked?
|
||||||
|
@element["checked"] == "checked"
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def other_options
|
def other_options
|
||||||
|
@ -12,4 +12,16 @@ module Webrat
|
|||||||
checkbox.should_not be_checked
|
checkbox.should_not be_checked
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe RadioField do
|
||||||
|
it "should say it is checked if it is" do
|
||||||
|
radio_button = RadioField.new(nil, (Webrat::XML.document("<input type='radio' checked='checked'>").search('input')).first)
|
||||||
|
radio_button.should be_checked
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should say it is not checked if it is not" do
|
||||||
|
radio_button = RadioField.new(nil, (Webrat::XML.document("<input type='radio'>").search('input')).first)
|
||||||
|
radio_button.should_not be_checked
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user