1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

remove unused XPath.css conversion

This commit is contained in:
Thomas Walpole 2013-02-18 16:01:52 -08:00
parent f53b83227f
commit 5ff2e65680
4 changed files with 11 additions and 5 deletions

View file

@ -147,7 +147,7 @@ module Capybara
elements = synchronize do
# base.find(query.xpath(exact)).map do |node|
if query.selector.preferred_format==:css
base.find(:css, query.locator)
base.find(:css, query.css)
else
base.find(:xpath, query.xpath(exact))
end.map do |node|

View file

@ -154,7 +154,11 @@ module Capybara
private
def resolve_query(query, exact=nil)
elements = native.xpath(query.xpath(exact)).map do |node|
elements = if query.selector.preferred_format == :css
native.css(query.css)
else
native.xpath(query.xpath(exact))
end.map do |node|
self.class.new(node)
end
Capybara::Result.new(elements, query)

View file

@ -91,6 +91,10 @@ module Capybara
@xpath.to_s
end
end
def css
@xpath
end
private

View file

@ -35,9 +35,7 @@ module Capybara
# Same as xpath, but wrap in XPath.css().
def css(&block)
@preferred_format = :css
if block
@xpath = xpath { |*args| XPath.css(block.call(*args)) }
end
@xpath = block if block
@xpath
end