Skip to content

Commit

Permalink
Added separate alert when all polling stations data entries have been…
Browse files Browse the repository at this point in the history
… finished
  • Loading branch information
Lionqueen94 committed Feb 11, 2025
1 parent 9d96510 commit e72177b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,40 @@ describe("Test PollingStationChoiceForm", () => {
expect(screen.getByText("Geen stembureaus gevonden")).toBeVisible();
});

test("All data entries of polling stations are finished, polling station list shows message", async () => {
overrideOnce("get", "/api/elections/1", 200, electionDetailsMockResponse);
overrideOnce("get", "/api/elections/1/status", 200, {
statuses: [
{
polling_station_id: 1,
status: "definitive",
},
{
polling_station_id: 2,
status: "definitive",
},
{
polling_station_id: 3,
status: "definitive",
},
{
polling_station_id: 4,
status: "entries_different",
},
],
} satisfies ElectionStatusResponse);

const user = userEvent.setup();
renderPollingStationChoicePage();

const openPollingStationList = await screen.findByTestId("openPollingStationList");
await user.click(openPollingStationList);
expect(screen.getByText("Kies het stembureau")).toBeVisible();

// Check if the error message is visible
expect(screen.getByText("Alle stembureaus zijn twee keer ingevoerd")).toBeVisible();
});

test("Second data entry has correct link", async () => {
overrideOnce("get", "/api/elections/1", 200, electionDetailsMockResponse);
overrideOnce("get", "/api/elections/1/status", 200, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@ export function PollingStationChoiceForm({ anotherEntry }: PollingStationChoiceF
</span>
</summary>
<h2 className={cls.formTitle}>{t("polling_station_choice.choose_polling_station")}</h2>
{!pollingStationsForDataEntry.length ? (
{!pollingStations.length ? (
<Alert type="error" variant="small">
<p>{t("polling_station_choice.no_polling_stations_found")}</p>
</Alert>
) : !pollingStationsForDataEntry.length ? (
<Alert type="notify" variant="small">
<p>{t("polling_station_choice.all_polling_stations_filled_in_twice")}</p>
</Alert>
) : (
<PollingStationsList pollingStations={pollingStationsForDataEntry} />
)}
Expand Down
19 changes: 10 additions & 9 deletions frontend/lib/i18n/locales/nl/polling_station_choice.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"all_polling_stations_filled_in_twice": "Alle stembureaus zijn twee keer ingevoerd",
"choose_polling_station": "Kies het stembureau",
"enter_a_valid_number_to_start": "Voer een geldig nummer van een stembureau in om te beginnen",
"polling_station_entry_not_possible": "Het stembureau dat je geselecteerd hebt kan niet meer ingevoerd worden",
"has_already_been_filled_twice": "Stembureau {nr} <strong>({name})</strong> is al twee keer ingevoerd",
"unfinished_input_title": "Je hebt nog een openstaande invoer",
"unfinished_input_content": "Je bent begonnen met het invoeren van onderstaande stembureaus, maar hebt deze nog niet helemaal afgerond:",
"insert_title": "Welk stembureau ga je invoeren?",
"insert_another": "Verder met een volgend stembureau?",
"insert_number": "Voer het nummer in:",
"insert_title": "Welk stembureau ga je invoeren?",
"name_correct_warning": "Klopt de naam van het stembureau met de naam op je papieren proces-verbaal?\nDan kan je beginnen. Klopt de naam niet? Overleg met de coördinator.",
"unknown_number": "Weet je het nummer niet?",
"view_list": "Bekijk de lijst met alle stembureaus",
"choose_polling_station": "Kies het stembureau",
"no_polling_station_found_with_number": "Geen stembureau gevonden met nummer {nr}",
"no_polling_stations_found": "Geen stembureaus gevonden",
"insert_number": "Voer het nummer in:",
"polling_station_entry_not_possible": "Het stembureau dat je geselecteerd hebt kan niet meer ingevoerd worden",
"searching": "aan het zoeken",
"no_polling_station_found_with_number": "Geen stembureau gevonden met nummer {nr}"
"unfinished_input_title": "Je hebt nog een openstaande invoer",
"unfinished_input_content": "Je bent begonnen met het invoeren van onderstaande stembureaus, maar hebt deze nog niet helemaal afgerond:",
"unknown_number": "Weet je het nummer niet?",
"view_list": "Bekijk de lijst met alle stembureaus"
}

0 comments on commit e72177b

Please sign in to comment.