class Domino::Form::Field
Attributes
callback[R]
locator[R]
name[R]
options[R]
Public Class Methods
new(name, locator, options = {}, &callback)
click to toggle source
# File lib/domino/form/field.rb, line 4 def initialize(name, locator, options = {}, &callback) @name = name @locator = locator @options = options @callback = callback extract_field_options end
Public Instance Methods
extract_field_options()
click to toggle source
Delete any options for your field type that shouldn't be passed to the field locator. Default: noop
# File lib/domino/form/field.rb, line 15 def extract_field_options; end
field(node)
click to toggle source
Locate the field using the locator and options
# File lib/domino/form/field.rb, line 28 def field(node) node.find_field(locator, options) end
read(node)
click to toggle source
Value that will be passed to the callback. Default: field_node.value
# File lib/domino/form/field.rb, line 34 def read(node) field(node).value end
value(node)
click to toggle source
Convert the value from `#read` via callback if provided.
# File lib/domino/form/field.rb, line 18 def value(node) val = read(node) if val && callback.is_a?(Proc) callback.call(val) else val end end
write(node, value)
click to toggle source
Sets the value on the field node. Default: node.fill_in for text fields.
# File lib/domino/form/field.rb, line 40 def write(node, value) node.fill_in(locator, with: value, **options) end