-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix showing of polling station number on input pages (#197)
Co-authored-by: cikzh <marlonpeeters@tweedegolf.com> Co-authored-by: Mark Janssen <20283+praseodym@users.noreply.github.com> Co-authored-by: Joep Schuurkes <145749778+jschuurk-kr@users.noreply.github.com>
- Loading branch information
1 parent
6fc980d
commit 8f6645a
Showing
37 changed files
with
437 additions
and
701 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ | |
align-items: center; | ||
} | ||
|
||
.input { | ||
text-align: right; | ||
} | ||
|
||
.result { | ||
margin: 0 1em; | ||
padding: 0 2em; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import { Outlet, useParams } from "react-router-dom"; | ||
import { Outlet } from "react-router-dom"; | ||
|
||
import { Footer } from "app/component/footer/Footer"; | ||
|
||
import { PollingStationProvider } from "@kiesraad/api"; | ||
import { PollingStationListProvider, useElection } from "@kiesraad/api"; | ||
|
||
export function InputLayout() { | ||
const { electionId } = useParams(); | ||
const { election } = useElection(); | ||
return ( | ||
<PollingStationProvider electionId={parseInt(electionId ?? "", 10)}> | ||
<PollingStationListProvider electionId={election.id}> | ||
<div className="app-layout"> | ||
<nav>Hello world</nav> | ||
|
||
<nav>{election.name}</nav> {/* TODO: Add Role in front of election name */} | ||
<Outlet /> | ||
|
||
<Footer /> | ||
</div> | ||
</PollingStationProvider> | ||
</PollingStationListProvider> | ||
); | ||
} |
9 changes: 9 additions & 0 deletions
9
frontend/app/module/input/PollingStation/PollingStationHomePage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Link } from "react-router-dom"; | ||
|
||
export function PollingStationHomePage() { | ||
return ( | ||
<span> | ||
Klik <Link to={"./recounted"}>hier</Link> om met de invoer te beginnen. | ||
</span> | ||
); | ||
} |
43 changes: 35 additions & 8 deletions
43
frontend/app/module/input/PollingStation/PollingStationLayout.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,47 @@ | ||
import { describe, expect, test } from "vitest"; | ||
import Router from "react-router"; | ||
|
||
import { render } from "app/test/unit"; | ||
import { describe, expect, test, vi } from "vitest"; | ||
|
||
import { ElectionListProvider, ElectionProvider } from "@kiesraad/api"; | ||
import { PollingStationLayout } from "app/module/input"; | ||
import { overrideOnce, render, screen } from "app/test/unit"; | ||
|
||
import { PollingStationLayout } from "./PollingStationLayout"; | ||
import { | ||
ElectionListProvider, | ||
ElectionProvider, | ||
PollingStationFormController, | ||
PollingStationListProvider, | ||
} from "@kiesraad/api"; | ||
import { | ||
electionMock, | ||
electionMockResponse, | ||
pollingStationMock, | ||
pollingStationsMockResponse, | ||
} from "@kiesraad/api-mocks"; | ||
|
||
describe("PollingStationLayout", () => { | ||
test("Enter form field values", () => { | ||
overrideOnce("get", "/api/elections/1", 200, electionMockResponse); | ||
overrideOnce("get", "/api/elections/1/polling_stations", 200, pollingStationsMockResponse); | ||
vi.spyOn(Router, "useParams").mockReturnValue({ | ||
electionId: electionMock.id.toString(), | ||
pollingStationId: pollingStationMock.id.toString(), | ||
}); | ||
test("Render", async () => { | ||
render( | ||
<ElectionListProvider> | ||
<ElectionProvider electionId={1}> | ||
<PollingStationLayout /> | ||
<ElectionProvider electionId={electionMock.id}> | ||
<PollingStationListProvider electionId={electionMock.id}> | ||
<PollingStationFormController | ||
election={electionMock} | ||
pollingStationId={pollingStationMock.id} | ||
entryNumber={1} | ||
> | ||
<PollingStationLayout /> | ||
</PollingStationFormController> | ||
</PollingStationListProvider> | ||
</ElectionProvider> | ||
</ElectionListProvider>, | ||
); | ||
expect(true).toBe(true); | ||
expect(await screen.findByText(pollingStationMock.name)); | ||
expect(await screen.findByText(pollingStationMock.number)); | ||
}); | ||
}); |
Oops, something went wrong.