Put most relevant methods at top of xpath class

This commit is contained in:
Jonas Nicklas 2010-03-12 20:13:10 +01:00
parent eef3a2c6bb
commit 7dba3bb9b9
1 changed files with 16 additions and 16 deletions

View File

@ -28,6 +28,22 @@ module Capybara
@paths = paths
end
def scope(scope)
XPath.new(*paths.map { |p| scope + p })
end
def to_s
@paths.join(' | ')
end
def append(path)
XPath.new(*[@paths, XPath.wrap(path).paths].flatten)
end
def prepend(path)
XPath.new(*[XPath.wrap(path).paths, @paths].flatten)
end
def from_css(css)
append(Nokogiri::CSS.xpath_for(css).first)
end
@ -96,22 +112,6 @@ module Capybara
add_field(locator, "//select", options)
end
def scope(scope)
XPath.new(*paths.map { |p| scope + p })
end
def to_s
@paths.join(' | ')
end
def append(path)
XPath.new(*[@paths, XPath.wrap(path).paths].flatten)
end
def prepend(path)
XPath.new(*[XPath.wrap(path).paths, @paths].flatten)
end
def checkbox(locator, options={})
input_field(:checkbox, locator, options)
end