Merge branch 'xpath_html_removal'

* xpath_html_removal:
  XPath::HTML is being removed from the xpath gem
This commit is contained in:
Thomas Walpole 2017-05-30 11:17:53 -07:00
commit a2aa5f7ded
4 changed files with 10 additions and 6 deletions

View File

@ -169,13 +169,14 @@ module Capybara
##
#
# Modify a selector previously created by {Capybara.add_selector}.
# For example modifying the :button selector to also find divs styled
# to look like buttons might look like this
# For example, adding a new filter to the :button selector to filter based on
# button style (a class) might look like this
#
# Capybara.modify_selector(:button) do
# xpath { |locator| XPath::HTML.button(locator).or(XPath::css('div.btn')[XPath::string.n.is(locator)]) }
# filter (:style, valid_values: [:primary, :secondary]) { |node, style| node[:class].split.include? "btn-#{style}" }
# end
#
#
# @param [Symbol] name The name of the selector to modify
# @yield A block executed in the context of the existing {Capybara::Selector}
#

View File

@ -16,7 +16,8 @@ Capybara::SpecHelper.spec "#all" do
it "should accept an XPath instance" do
@session.visit('/form')
@xpath = XPath::HTML.fillable_field('Name')
@xpath = Capybara::Selector.all[:fillable_field].call('Name')
expect(@xpath).to be_a(::XPath::Union)
@result = @session.all(@xpath).map { |r| r.value }
expect(@result).to include('Smith', 'John', 'John Smith')
end

View File

@ -210,7 +210,8 @@ Capybara::SpecHelper.spec '#find' do
it "should accept an XPath instance" do
@session.visit('/form')
@xpath = XPath::HTML.fillable_field('First Name')
@xpath = Capybara::Selector.all[:fillable_field].call('First Name')
expect(@xpath).to be_a(::XPath::Union)
expect(@session.find(@xpath).value).to eq('John')
end

View File

@ -15,7 +15,8 @@ Capybara::SpecHelper.spec '#first' do
it "should accept an XPath instance" do
@session.visit('/form')
@xpath = XPath::HTML.fillable_field('First Name')
@xpath = Capybara::Selector.all[:fillable_field].call('First Name')
expect(@xpath).to be_a(::XPath::Union)
expect(@session.first(@xpath).value).to eq('John')
end