mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Put most relevant methods at top of xpath class
This commit is contained in:
parent
eef3a2c6bb
commit
7dba3bb9b9
1 changed files with 16 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue