Use a button to show/hide password in the management area
When using a link, people using screen readers might think they're going to a new page where the password is going to be shown. With a button, they get a better idea about what to expect. Furthermore, with a button, we can use the `aria-pressed` attribute to indicate whether the password is currently being shown.
This commit is contained in:
@@ -60,14 +60,17 @@ describe "Account" do
|
||||
new_password = find_field("user_password").value
|
||||
|
||||
expect(page).to have_field "Password", type: :password
|
||||
expect(page).to have_css "button[aria-pressed=false]", exact_text: "Show password"
|
||||
|
||||
click_link "Show password"
|
||||
click_button "Show password"
|
||||
|
||||
expect(page).to have_field "Password", type: :text
|
||||
expect(page).to have_css "button[aria-pressed=true]", exact_text: "Show password"
|
||||
|
||||
click_link "Show password"
|
||||
click_button "Show password"
|
||||
|
||||
expect(page).to have_field "Password", type: :password
|
||||
expect(page).to have_css "button[aria-pressed=false]", exact_text: "Show password"
|
||||
|
||||
click_button "Save password"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user