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:
parent
f53b83227f
commit
5ff2e65680
4 changed files with 11 additions and 5 deletions
|
@ -147,7 +147,7 @@ module Capybara
|
||||||
elements = synchronize do
|
elements = synchronize do
|
||||||
# base.find(query.xpath(exact)).map do |node|
|
# base.find(query.xpath(exact)).map do |node|
|
||||||
if query.selector.preferred_format==:css
|
if query.selector.preferred_format==:css
|
||||||
base.find(:css, query.locator)
|
base.find(:css, query.css)
|
||||||
else
|
else
|
||||||
base.find(:xpath, query.xpath(exact))
|
base.find(:xpath, query.xpath(exact))
|
||||||
end.map do |node|
|
end.map do |node|
|
||||||
|
|
|
@ -154,7 +154,11 @@ module Capybara
|
||||||
private
|
private
|
||||||
|
|
||||||
def resolve_query(query, exact=nil)
|
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)
|
self.class.new(node)
|
||||||
end
|
end
|
||||||
Capybara::Result.new(elements, query)
|
Capybara::Result.new(elements, query)
|
||||||
|
|
|
@ -92,6 +92,10 @@ module Capybara
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def css
|
||||||
|
@xpath
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def assert_valid_keys!
|
def assert_valid_keys!
|
||||||
|
|
|
@ -35,9 +35,7 @@ module Capybara
|
||||||
# Same as xpath, but wrap in XPath.css().
|
# Same as xpath, but wrap in XPath.css().
|
||||||
def css(&block)
|
def css(&block)
|
||||||
@preferred_format = :css
|
@preferred_format = :css
|
||||||
if block
|
@xpath = block if block
|
||||||
@xpath = xpath { |*args| XPath.css(block.call(*args)) }
|
|
||||||
end
|
|
||||||
@xpath
|
@xpath
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue