Namespace locators in Webrat::Locators

This commit is contained in:
Bryan Helmkamp 2008-11-29 02:00:57 -05:00
parent d7eec20950
commit a472bbfbde
6 changed files with 169 additions and 133 deletions

View File

@ -1,5 +1,8 @@
require "webrat/core/locators/locator"
module Webrat
module Locators
class AreaLocator < Locator
def locate
@ -22,3 +25,6 @@ class AreaLocator < Locator
end
end
end
end

View File

@ -1,5 +1,8 @@
require "webrat/core/locators/locator"
module Webrat
module Locators
class ButtonLocator < Locator
def locate
@ -34,7 +37,10 @@ class ButtonLocator < Locator
end
def button_elements
Webrat::XML.xpath_search(@scope.dom, *Webrat::ButtonField.xpath_search)
Webrat::XML.xpath_search(@scope.dom, *ButtonField.xpath_search)
end
end
end
end

View File

@ -1,5 +1,8 @@
require "webrat/core/locators/locator"
module Webrat
module Locators
class FieldByIdLocator < Locator
def locate
@ -17,7 +20,10 @@ class FieldByIdLocator < Locator
end
def field_elements
Webrat::XML.xpath_search(@scope.dom, *Webrat::Field.xpath_search)
Webrat::XML.xpath_search(@scope.dom, *Field.xpath_search)
end
end
end
end

View File

@ -1,5 +1,8 @@
require "webrat/core/locators/locator"
module Webrat
module Locators
class FieldNamedLocator < Locator
def locate
@ -25,3 +28,6 @@ class FieldNamedLocator < Locator
end
end
end
end

View File

@ -1,5 +1,8 @@
require "webrat/core/locators/locator"
module Webrat
module Locators
class LinkLocator < Locator
def locate
@ -38,7 +41,7 @@ class LinkLocator < Locator
end
def link_elements
Webrat::XML.css_search(@scope.dom, *Webrat::Link.css_search)
Webrat::XML.css_search(@scope.dom, *Link.css_search)
end
def replace_nbsp(str)
@ -50,3 +53,6 @@ class LinkLocator < Locator
end
end
end
end

View File

@ -1,3 +1,6 @@
module Webrat
module Locators
class Locator
def initialize(scope, value, *field_types)
@ -7,3 +10,6 @@ class Locator
end
end
end
end