Class FormTestHelper::RadioButtonGroup
In: lib/form_test_helper.rb
Parent: Field

Methods

Public Instance methods

[Source]

     # File lib/form_test_helper.rb, line 291
291:     def initial_value
292:       checked_tags = tags.select {|tag| tag['checked'] }
293:       # If multiple radio buttons are checked, Firefox uses the last one
294:       # If none, the value is undefined and is not submitted
295:       checked_tags.any? ? checked_tags.last['value'] : nil
296:     end

[Source]

     # File lib/form_test_helper.rb, line 298
298:     def options
299:       tags.collect {|tag| tag['value'] }
300:     end

[Source]

     # File lib/form_test_helper.rb, line 302
302:     def value=(value)
303:       if options.include?(value)
304:         @value = value
305:       else
306:         raise "Can't set value '#{value}' for #{self.name} that isn't one of the radio buttons."
307:       end
308:     end

[Validate]