Hides not to vote at this time button if already voted
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
$("#<%= dom_id(@poll) %> #actions").html("<%= j render("voted") %>");
|
||||
$("#<%= dom_id(@poll) %> #can_vote_callout").hide();
|
||||
$("#not_voted").hide();
|
||||
$(".js-vote-collection").removeClass("is-hidden");
|
||||
|
||||
@@ -28,4 +28,8 @@
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% if Poll.votable_by(@user).any? %>
|
||||
<div id="not_voted">
|
||||
<%= link_to t("officing.voters.new.not_to_vote"), namespaced_root_path, class: "button" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -87,6 +87,43 @@ feature "Voter" do
|
||||
end
|
||||
end
|
||||
|
||||
context "The person has decided not to vote at this time" do
|
||||
let!(:user) { create(:user, :in_census) }
|
||||
|
||||
scenario "Show not to vote at this time button" do
|
||||
login_through_form_as_officer(officer.user)
|
||||
|
||||
visit new_officing_residence_path
|
||||
officing_verify_residence
|
||||
|
||||
expect(page).to have_content poll.name
|
||||
expect(page).to have_button "Confirm vote"
|
||||
expect(page).to have_content "Can vote"
|
||||
expect(page).to have_link "The person has decided not to vote at this time"
|
||||
end
|
||||
|
||||
scenario "Hides not to vote at this time button if already voted", :js do
|
||||
login_through_form_as_officer(officer.user)
|
||||
|
||||
visit new_officing_residence_path
|
||||
officing_verify_residence
|
||||
|
||||
within("#poll_#{poll.id}") do
|
||||
click_button("Confirm vote")
|
||||
expect(page).not_to have_button("Confirm vote")
|
||||
expect(page).to have_content "Vote introduced!"
|
||||
expect(page).not_to have_content "The person has decided not to vote at this time"
|
||||
end
|
||||
|
||||
visit new_officing_residence_path
|
||||
officing_verify_residence
|
||||
|
||||
expect(page).to have_content "Has already participated in this poll"
|
||||
expect(page).not_to have_content "The person has decided not to vote at this time"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Trying to vote the same poll in booth and web" do
|
||||
let!(:user) { create(:user, :in_census) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user