Allow toggling elements with the keyboard

Using `<a>` tags with no `href` means these elements cannot be activated
by keyboard users, so we're replacing them with buttons.

In the future we probably want to add more consistency so all toggle
buttons use the same code. We might also add styles depending on the
`aria-expanded` property.
This commit is contained in:
Javi Martín
2021-03-27 18:26:44 +01:00
parent bfbbda00e3
commit 6ea9383743
22 changed files with 127 additions and 68 deletions

View File

@@ -41,10 +41,15 @@ describe "Proposal's dashboard" do
expect(page).to have_content(goal.title)
expect(page).not_to have_content(future_goal.title)
find(:css, "#see_complete_course_link").click
click_button "Check out the complete course"
expect(page).to have_content(goal.title)
expect(page).to have_content(future_goal.title)
click_button "Hide course"
expect(page).to have_content(goal.title)
expect(page).not_to have_content(future_goal.title)
end
end
@@ -69,7 +74,7 @@ describe "Proposal's dashboard" do
expect(page).to have_content(action.description)
expect(page).to have_content("This is a really very long description for a proposed")
expect(page).to have_selector("#truncated_description_dashboard_action_#{action_long.id}")
expect(page).to have_selector("a", text: "Show description")
expect(page).to have_button("Show description")
end
scenario "Dashboard progress do not display from the fourth proposed actions", js: true do
@@ -420,9 +425,13 @@ describe "Proposal's dashboard" do
action_5 = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
find(:css, "#see_proposed_actions_link_pending").click
click_button "Check out recommended actions"
expect(page).to have_content(action_5.title)
click_button "Hide recommended actions"
expect(page).not_to have_content(action_5.title)
end
scenario "On recommended actions section display four proposed actions", js: true do