mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Fix :element selector without element type
This commit is contained in:
parent
76dc18b369
commit
39a46bbba0
2 changed files with 5 additions and 1 deletions
|
@ -460,7 +460,7 @@ end
|
|||
|
||||
Capybara.add_selector(:element) do
|
||||
xpath do |locator, **|
|
||||
XPath.descendant((locator || '@').to_sym)
|
||||
locator ? XPath.descendant(locator.to_sym) : XPath.descendant
|
||||
end
|
||||
|
||||
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
|
||||
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
|
||||
expect { string.find(:element, 'input', not_there: 'bad', count: 1) }
|
||||
.to(raise_error do |e|
|
||||
|
|
Loading…
Add table
Reference in a new issue