Extract FieldLabeledLocator
This commit is contained in:
parent
1723157528
commit
f6a9bed41e
|
@ -31,10 +31,9 @@ module Webrat
|
|||
end
|
||||
|
||||
def find_field_labeled(label, *field_types) #:nodoc:
|
||||
# TODO - Convert to using elements
|
||||
forms.detect_mapped do |form|
|
||||
form.field_labeled(label, *field_types)
|
||||
end
|
||||
require "webrat/core/locators/field_labeled_locator"
|
||||
|
||||
FieldLabeledLocator.new(self, label, *field_types).locate
|
||||
end
|
||||
|
||||
def find_field_named(name, *field_types) #:nodoc:
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
require "webrat/core/locators/locator"
|
||||
|
||||
module Webrat
|
||||
module Locators
|
||||
|
||||
class FieldLabeledLocator < Locator
|
||||
|
||||
def locate
|
||||
# TODO - Convert to using elements
|
||||
@scope.send(:forms).detect_mapped do |form|
|
||||
form.field_labeled(@value, *@field_types)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue