Removing more dead methods
This commit is contained in:
parent
c05c0f6c73
commit
9ace546766
|
@ -9,14 +9,6 @@ module Webrat
|
||||||
".//label"
|
".//label"
|
||||||
end
|
end
|
||||||
|
|
||||||
def text
|
|
||||||
str = Webrat::XML.all_inner_text(@element)
|
|
||||||
str.gsub!("\n","")
|
|
||||||
str.strip!
|
|
||||||
str.squeeze!(" ")
|
|
||||||
str
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_id
|
def for_id
|
||||||
Webrat::XML.attribute(@element, "for")
|
Webrat::XML.attribute(@element, "for")
|
||||||
end
|
end
|
||||||
|
@ -25,6 +17,8 @@ module Webrat
|
||||||
Field.load(@session, field_element)
|
Field.load(@session, field_element)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
def field_element
|
def field_element
|
||||||
if for_id.blank?
|
if for_id.blank?
|
||||||
Webrat::XML.xpath_at(@element, *Field.xpath_search)
|
Webrat::XML.xpath_at(@element, *Field.xpath_search)
|
||||||
|
|
|
@ -7,15 +7,13 @@ module Webrat
|
||||||
class FieldLabeledLocator < Locator
|
class FieldLabeledLocator < Locator
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
matching_fields.min { |a, b| a.label_text.length <=> b.label_text.length }
|
matching_labels.any? && matching_labels.first.field
|
||||||
end
|
|
||||||
|
|
||||||
def matching_fields
|
|
||||||
matching_labels.map(&:field).compact.uniq
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def matching_labels
|
def matching_labels
|
||||||
matching_label_elements.map do |label_element|
|
matching_label_elements.sort_by do |label_element|
|
||||||
|
text(label_element).length
|
||||||
|
end.map do |label_element|
|
||||||
Label.load(@scope.session, label_element)
|
Label.load(@scope.session, label_element)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue