| Class | FormTestHelper::Field |
| In: |
lib/form_test_helper.rb
|
| Parent: | Object |
| name | [R] | |
| tags | [R] | |
| value | [RW] |
# File lib/form_test_helper.rb, line 245
245: def initialize(tags)
246: @tags = tags
247: reset
248: end
# File lib/form_test_helper.rb, line 254
254: def initial_value
255: if tag['value']
256: tag['value']
257: elsif tag.children
258: tag.children.to_s
259: end
260: end
The name for the field (which may have multiple values) Multiple form elements with the same name are considered only one field. Fields that return multiple values when submitted are indicated with square brackets at the end of their name in HTML, but have no such ending internal to this class.
# File lib/form_test_helper.rb, line 266
266: def name
267: tag['name'].gsub(/\[\]$/, '')
268: end
# File lib/form_test_helper.rb, line 278
278: def proxy
279: returning @value do |value|
280: value.extend(FieldProxy)
281: value.field = self
282: end
283: end