Class: Webrat::ButtonField

Inherits:
Field show all
Defined in:
lib/webrat/core/elements/field.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Field

#value

Attributes inherited from Element

#element

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Field

#disabled?, field_class, field_classes, #id, inherited, #initialize, #label_text, load, #name, #raise_error_if_disabled, #set, #to_multipart_param, #unset

Methods inherited from Element

#initialize, #inspect, load, load_all, #path

Constructor Details

This class inherits a constructor from Webrat::Field

Class Method Details

.xpath_searchObject



184
185
186
# File 'lib/webrat/core/elements/field.rb', line 184

def self.xpath_search
  [".//button", ".//input[@type = 'submit']", ".//input[@type = 'button']", ".//input[@type = 'image']"]
end

Instance Method Details

#clickObject



197
198
199
200
201
# File 'lib/webrat/core/elements/field.rb', line 197

def click
  raise_error_if_disabled
  set(Webrat::XML.attribute(@element, "value")) unless Webrat::XML.attribute(@element, "name").blank?
  form.submit
end

#default_valueObject



193
194
195
# File 'lib/webrat/core/elements/field.rb', line 193

def default_value
  nil
end

#to_paramObject



188
189
190
191
# File 'lib/webrat/core/elements/field.rb', line 188

def to_param
  return nil if @value.nil?
  super
end