Module: Watir::RadioGroupCommonWatir

Included in:
FireWatir::RadioGroup, RadioGroup
Defined in:
lib/watirloo/extension/watir_ducktape.rb

Overview

for firefox and ie

Instance Method Summary collapse

Instance Method Details

#selected_radioObject

returns radio that is selected. there can only be one radio selected. in the event that none is selected it returns nil see selected_value commentary



104
105
106
# File 'lib/watirloo/extension/watir_ducktape.rb', line 104

def selected_radio
  @o.find {|r| r.isSet?}
end

#selected_valuesObject

Only one radio in RadioGroup can be selected just like only one option in single select list box can be selected. this method is a bit gratuitious because it will always return array with one item but it’s here to keep the plural for compatibility with CheckboxGroup or SelectList. if at some point your page object gets changed from RadioGroup to SelectList your tests will not have to change



95
96
97
# File 'lib/watirloo/extension/watir_ducktape.rb', line 95

def selected_values
  selected_value.to_a
end

#set?Boolean

if a radio button in a group is set then the group is set by default it should be set but many HTML implementations provide the radiogroup to the user with no default one set (Bad practice perhaps)

Returns:

  • (Boolean)


111
112
113
# File 'lib/watirloo/extension/watir_ducktape.rb', line 111

def set?
  selected_radio ? true : false
end