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