As mentioned in commits5311daadfandbb958daf0, using links combined with JavaScript to generate POST requests to the server has a few issues. We're also improving the keyboard access. Previously, the links were focusable and clickable with the keyboard. Now we're disabling the buttons when voting isn't allowed. Since these elements can no longer be focused, we're adding an element with `tabindex="0"` so the "participation not allowed" message is shown, like we do in most places. Note we're slightly changing one test because now when hovering over the button on Chrome, the "participation not allowed" text isn't shown; it's only shown when hovering on the parts of the `div.ballot` element outside the button. Since we're already rewriting the behavior of the "participation not allowed" text in a different pull request, we aren't going to fix this behavior.
19 lines
486 B
Ruby
19 lines
486 B
Ruby
module Budgets
|
|
def expect_message_organizations_cannot_vote
|
|
expect(page).to have_content "Organization"
|
|
expect(page).to have_button "Vote", disabled: true, obscured: true
|
|
end
|
|
|
|
def hover_over_ballot
|
|
scroll_to find("div.ballot"), align: :bottom
|
|
first("div.ballot p").hover
|
|
end
|
|
|
|
def add_to_ballot(investment_title)
|
|
within(".budget-investment", text: investment_title) do
|
|
click_button "Vote"
|
|
expect(page).to have_content "Remove"
|
|
end
|
|
end
|
|
end
|