diff --git a/app/assets/javascripts/polls_admin.js.coffee b/app/assets/javascripts/polls_admin.js.coffee index 343a7c255..a2d0569a7 100644 --- a/app/assets/javascripts/polls_admin.js.coffee +++ b/app/assets/javascripts/polls_admin.js.coffee @@ -7,6 +7,7 @@ App.PollsAdmin = when "vote_collection" $("select[class='js-shift-vote-collection-dates']").show() $("select[class='js-shift-recount-scrutiny-dates']").hide() + break when "recount_scrutiny" $("select[class='js-shift-recount-scrutiny-dates']").show() $("select[class='js-shift-vote-collection-dates']").hide() diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 1aead8555..8e02ca9b4 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -124,6 +124,24 @@ describe "Admin shifts" do expect(page).to have_select("shift_date_recount_scrutiny_date", options: ["Select day", *recount_scrutiny_dates]) end + scenario "Change option from Recount & Scrutinity to Collect Votes", :js do + booth = create(:poll_booth) + officer = create(:poll_officer) + + create(:poll_shift, :vote_collection_task, officer: officer, booth: booth) + create(:poll_shift, :recount_scrutiny_task, officer: officer, booth: booth) + + visit new_admin_booth_shift_path(booth, officer_id: officer.id) + + select "Recount & Scrutiny", from: "shift_task" + + expect(page).to have_select("shift_date_recount_scrutiny_date", options: ["Select day"]) + + select "Collect Votes", from: "shift_task" + + expect(page).to have_select("shift_date_vote_collection_date", options: ["Voting days ended"]) + end + scenario "Error on create", :js do poll = create(:poll, :current) booth = create(:poll_booth)