mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add type to button selector filters
This commit is contained in:
parent
383211de9f
commit
1bfa369be4
2 changed files with 6 additions and 1 deletions
|
@ -185,7 +185,7 @@ end
|
|||
# @filter [String] :value Matches the value of an input button
|
||||
#
|
||||
Capybara.add_selector(:button) do
|
||||
xpath(:value, :title) do |locator, **options|
|
||||
xpath(:value, :title, :type) do |locator, **options|
|
||||
input_btn_xpath = XPath.descendant(:input)[XPath.attr(:type).one_of('submit', 'reset', 'image', 'button')]
|
||||
btn_xpath = XPath.descendant(:button)
|
||||
image_btn_xpath = XPath.descendant(:input)[XPath.attr(:type) == 'image']
|
||||
|
|
|
@ -34,6 +34,11 @@ Capybara::SpecHelper.spec '#has_button?' do
|
|||
it "should be true for enabled buttons if disabled: :all" do
|
||||
expect(@session).to have_button('med', disabled: :all)
|
||||
end
|
||||
|
||||
it "can verify button type" do
|
||||
expect(@session).to have_button('awe123', type: 'submit')
|
||||
expect(@session).not_to have_button('awe123', type: 'reset')
|
||||
end
|
||||
end
|
||||
|
||||
Capybara::SpecHelper.spec '#has_no_button?' do
|
||||
|
|
Loading…
Reference in a new issue