From 29cb1a17bb0f478ed91cfa76a462dd6a502e455b Mon Sep 17 00:00:00 2001 From: osatoh Date: Mon, 18 Nov 2024 16:34:28 +0900 Subject: [PATCH] Add tests for 'exact: true' option in have_button and have_no_button --- lib/capybara/spec/session/has_button_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/capybara/spec/session/has_button_spec.rb b/lib/capybara/spec/session/has_button_spec.rb index 2378d1912..45b875133 100644 --- a/lib/capybara/spec/session/has_button_spec.rb +++ b/lib/capybara/spec/session/has_button_spec.rb @@ -37,6 +37,10 @@ expect(@session).to have_button('med', disabled: :all) end + it 'should be true for exact match if exact: true' do + expect(@session).to have_button('med', exact: true) + end + it 'can verify button type' do expect(@session).to have_button('awe123', type: 'submit') expect(@session).not_to have_button('awe123', type: 'reset') @@ -111,6 +115,10 @@ expect(@session).to have_no_button('Disabled button', disabled: false) end + it 'should be true for no exact match if exact: true' do + expect(@session).to have_no_button('button', exact: true) + end + it 'should be true for role=button when enable_aria_role: false' do expect(@session).to have_no_button('ARIA button', enable_aria_role: false) end