Extract FieldLabeledLocator

This commit is contained in:
Bryan Helmkamp 2008-11-29 13:02:05 -05:00
parent 1723157528
commit f6a9bed41e
2 changed files with 21 additions and 4 deletions

View File

@ -31,10 +31,9 @@ module Webrat
end end
def find_field_labeled(label, *field_types) #:nodoc: def find_field_labeled(label, *field_types) #:nodoc:
# TODO - Convert to using elements require "webrat/core/locators/field_labeled_locator"
forms.detect_mapped do |form|
form.field_labeled(label, *field_types) FieldLabeledLocator.new(self, label, *field_types).locate
end
end end
def find_field_named(name, *field_types) #:nodoc: def find_field_named(name, *field_types) #:nodoc:

View File

@ -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