Fix :element selector without element type
This commit is contained in:
parent
76dc18b369
commit
39a46bbba0
|
@ -460,7 +460,7 @@ end
|
||||||
|
|
||||||
Capybara.add_selector(:element) do
|
Capybara.add_selector(:element) do
|
||||||
xpath do |locator, **|
|
xpath do |locator, **|
|
||||||
XPath.descendant((locator || '@').to_sym)
|
locator ? XPath.descendant(locator.to_sym) : XPath.descendant
|
||||||
end
|
end
|
||||||
|
|
||||||
expression_filter(:attributes, matcher: /.+/) do |xpath, name, val|
|
expression_filter(:attributes, matcher: /.+/) do |xpath, name, val|
|
||||||
|
|
|
@ -261,6 +261,10 @@ RSpec.describe Capybara do
|
||||||
expect { string.all(:element, 'input', type: 'submit', count: 1) }.not_to raise_error
|
expect { string.all(:element, 'input', type: 'submit', count: 1) }.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'works without element type' do
|
||||||
|
expect(string.find(:element, type: 'submit').value).to eq 'click me'
|
||||||
|
end
|
||||||
|
|
||||||
it 'includes wildcarded keys in description' do
|
it 'includes wildcarded keys in description' do
|
||||||
expect { string.find(:element, 'input', not_there: 'bad', count: 1) }
|
expect { string.find(:element, 'input', not_there: 'bad', count: 1) }
|
||||||
.to(raise_error do |e|
|
.to(raise_error do |e|
|
||||||
|
|
Loading…
Reference in New Issue