Use [disabled] attribute only on tags that support it

Add Capybara selector for disabled links.
This commit is contained in:
2026-07-06 18:28:34 +02:00
parent d4be84875e
commit 774b1eb19b
5 changed files with 31 additions and 26 deletions

View File

@@ -8,7 +8,7 @@ class UsersTest < ApplicationSystemTestCase
test 'sign in' do
visit root_url
assert find_link(href: new_user_session_path)[:disabled]
assert_selector :link, text: t(:sign_in), disabled: true
sign_in
assert_no_current_path new_user_session_path
@@ -27,7 +27,7 @@ class UsersTest < ApplicationSystemTestCase
assert_current_path new_user_session_path
assert_text t('devise.failure.invalid', authentication_keys: label.downcase_first)
assert find_link(href: new_user_session_path)[:disabled]
assert_selector :link, text: t(:sign_in), disabled: true
assert has_field?(label, with: email)
end
@@ -89,7 +89,7 @@ class UsersTest < ApplicationSystemTestCase
test 'register' do
visit root_url
click_on t(:register)
assert find_link(href: new_user_registration_path)[:disabled]
assert_selector :link, text: t(:register), disabled: true
fill_in User.human_attribute_name(:email), with: random_email
password = random_password