XPath::HTML is being removed from the xpath gem
This commit is contained in:
parent
21f01c507d
commit
d7424422e1
|
@ -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}
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue