1
0
Fork 0
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:
Thomas Walpole 2018-04-10 19:42:39 -07:00
parent 383211de9f
commit 1bfa369be4
2 changed files with 6 additions and 1 deletions

View file

@ -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']

View file

@ -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