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

Methods

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Validate]