Class: Webrat::CheckboxField
- Inherits:
-
Field
show all
- Defined in:
- lib/webrat/core/elements/field.rb
Overview
Instance Attribute Summary
Attributes inherited from Field
#value
Attributes inherited from Element
#element
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Field
#disabled?, field_class, field_classes, #id, inherited, #initialize, #label_text, load, #raise_error_if_disabled, #set, #unset, xpath_search_excluding_hidden
Methods inherited from Element
#initialize, #inspect, load, load_all, #path
Constructor Details
This class inherits a constructor from Webrat::Field
Class Method Details
.xpath_search ⇒ Object
238
239
240
|
# File 'lib/webrat/core/elements/field.rb', line 238
def self.xpath_search
".//input[@type = 'checkbox']"
end
|
Instance Method Details
247
248
249
250
|
# File 'lib/webrat/core/elements/field.rb', line 247
def check
raise_error_if_disabled
set(Webrat::XML.attribute(@element, "value") || "on")
end
|
#checked? ⇒ Boolean
252
253
254
|
# File 'lib/webrat/core/elements/field.rb', line 252
def checked?
Webrat::XML.attribute(@element, "checked") == "checked"
end
|
242
243
244
245
|
# File 'lib/webrat/core/elements/field.rb', line 242
def to_param
return nil if @value.nil?
super
end
|
256
257
258
259
|
# File 'lib/webrat/core/elements/field.rb', line 256
def uncheck
raise_error_if_disabled
set(nil)
end
|