diff --git a/CHANGELOG.md b/CHANGELOG.md index fc59866f..b1384c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ changes. ### Changed -- +- Change constitutional committee vote totals to be constitutional for yes and unconstitutional for no [Issue 2062](https://github.com/IntersectMBO/govtool/issues/2062) ### Removed diff --git a/govtool/frontend/junit-report.xml b/govtool/frontend/junit-report.xml index 2f3434f9..1396b87e 100644 --- a/govtool/frontend/junit-report.xml +++ b/govtool/frontend/junit-report.xml @@ -1,230 +1,256 @@ - - - + + + - - - + - + - + + + - + - + - + - + - - + + - + - + - - - + + + - + + + - + - + - + - - - + - - + + - + - + - + - - + + - + - + - - + + - + + + - + - + - + - + - + - + - + - + + + - + - + - + + + - + - + + + - + - - - - + + - + - - + + - - - - - - + + - + - + - + - + + + - + - - + + - + - + - + - + + + - + - - + + - + - + - + + + - - + + - + - + - + - + - - + + - + + + - - + + - + + + - + - + - - + + - + - + + + + +Error: Failed to get PubDRepKey + at [90m/Users/asiadyczka/Desktop/govtool/govtool/frontend/[39msrc/utils/tests/getDRepID.test.ts:46:40 + at [90mfile:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:135:14 + at [90mfile:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:60:26 + at runTest [90m(file:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:781:17[90m)[39m +[90m at processTicksAndRejections (node:internal/process/task_queues:95:5)[39m + at runSuite [90m(file:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:909:15[90m)[39m + at runSuite [90m(file:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:909:15[90m)[39m + at runFiles [90m(file:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:958:5[90m)[39m + at startTests [90m(file:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4m@vitest[24m/runner/dist/index.js:967:3[90m)[39m + at [90mfile:///Users/asiadyczka/Desktop/govtool/govtool/frontend/[39mnode_modules/[4mvitest[24m/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:116:7 + + - - + + - + - + - - - + - + - + + + - + - - - + + + - - + + - + - - - + - + - + @@ -234,88 +260,112 @@ - - + + - + - - - + - + - - + + - + - - - + - + - + - - - + - + - + - + - - - + - + + + + + + + + + + + - - + + - + - + + + + + - - + + - + - + - + + + + + - - + + - + - + - + + + - + + + + + - - + + - + - + - + - + + + + + + + + + diff --git a/govtool/frontend/src/components/atoms/VotePill.test.tsx b/govtool/frontend/src/components/atoms/VotePill.test.tsx index 24f09a4d..69bae398 100644 --- a/govtool/frontend/src/components/atoms/VotePill.test.tsx +++ b/govtool/frontend/src/components/atoms/VotePill.test.tsx @@ -5,7 +5,7 @@ import { VotePill } from "@atoms"; describe("VotePill", () => { it('renders the VotePill component with "yes" vote correctly', () => { const { getByText } = render(); - const voteText = getByText("yes"); + const voteText = getByText("Yes"); expect(voteText).toBeInTheDocument(); expect(voteText.parentNode).toHaveStyle({ borderColor: "#C0E4BA", @@ -15,7 +15,7 @@ describe("VotePill", () => { it('renders the VotePill component with "no" vote correctly', () => { const { getByText } = render(); - const voteText = getByText("no"); + const voteText = getByText("No"); expect(voteText).toBeInTheDocument(); expect(voteText.parentNode).toHaveStyle({ borderColor: "#EDACAC", @@ -25,7 +25,7 @@ describe("VotePill", () => { it('renders the VotePill component with "abstain" vote correctly', () => { const { getByText } = render(); - const voteText = getByText("abstain"); + const voteText = getByText("Abstain"); expect(voteText).toBeInTheDocument(); expect(voteText.parentNode).toHaveStyle({ borderColor: "#99ADDE", diff --git a/govtool/frontend/src/components/atoms/VotePill.tsx b/govtool/frontend/src/components/atoms/VotePill.tsx index de29ac90..53ad58ec 100644 --- a/govtool/frontend/src/components/atoms/VotePill.tsx +++ b/govtool/frontend/src/components/atoms/VotePill.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from "react-i18next"; import { Box, Typography } from "@mui/material"; import { Vote } from "@models"; @@ -6,12 +7,15 @@ export const VotePill = ({ vote, width, maxWidth, + isCC, }: { vote: Vote; width?: number; maxWidth?: number; + isCC?: boolean; }) => { - const VOTE = vote.toLowerCase(); + const { t } = useTranslation(); + const VOTE = vote.toLowerCase() as "yes" | "no" | "abstain"; return ( - {vote} + {t( + `votes.${ + isCC + ? VOTE === "yes" + ? "constitutional" + : vote === "no" + ? "unconstitutional" + : VOTE + : VOTE + }`, + )} ); diff --git a/govtool/frontend/src/components/molecules/VoteActionForm.tsx b/govtool/frontend/src/components/molecules/VoteActionForm.tsx index 79e13120..e7fd496f 100644 --- a/govtool/frontend/src/components/molecules/VoteActionForm.tsx +++ b/govtool/frontend/src/components/molecules/VoteActionForm.tsx @@ -170,7 +170,7 @@ export const VoteActionForm = ({ name="vote" register={registerInput} setValue={setValue} - title={t("yes")} + title={t("votes.yes")} value="yes" disabled={isInProgress} /> @@ -180,7 +180,7 @@ export const VoteActionForm = ({ name="vote" register={registerInput} setValue={setValue} - title={t("no")} + title={t("votes.no")} value="no" disabled={isInProgress} /> @@ -190,7 +190,7 @@ export const VoteActionForm = ({ name="vote" register={registerInput} setValue={setValue} - title={t("abstain")} + title={t("votes.abstain")} value="abstain" disabled={isInProgress} /> diff --git a/govtool/frontend/src/components/molecules/VotesSubmitted.tsx b/govtool/frontend/src/components/molecules/VotesSubmitted.tsx index e78d8de3..14aa7d0c 100644 --- a/govtool/frontend/src/components/molecules/VotesSubmitted.tsx +++ b/govtool/frontend/src/components/molecules/VotesSubmitted.tsx @@ -88,8 +88,10 @@ export const VotesSubmitted = ({ ); }; +type VoterType = "ccCommittee" | "dReps" | "sPos"; + type VotesGroupProps = { - type: "ccCommittee" | "dReps" | "sPos"; + type: VoterType; yesVotes: number; noVotes: number; abstainVotes: number; @@ -127,8 +129,8 @@ const VotesGroup = ({ }; type VoteProps = { - type: "ccCommittee" | "dReps" | "sPos"; - vote: "yes" | "no" | "abstain"; + type: VoterType; + vote: VoteType; value: number; }; const Vote = ({ type, vote, value }: VoteProps) => ( @@ -140,7 +142,7 @@ const Vote = ({ type, vote, value }: VoteProps) => ( columnGap: 1.5, }} > - + { const canvas = within(canvasElement); - await expect(canvas.getByText(/yes/i)).toBeInTheDocument(); + await expect(canvas.getByText(/Yes/i)).toBeInTheDocument(); }, }; @@ -35,7 +35,7 @@ export const VotePillNo: Story = { }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); - await expect(canvas.getByText(/no/i)).toBeInTheDocument(); + await expect(canvas.getByText(/No/i)).toBeInTheDocument(); }, }; @@ -45,6 +45,6 @@ export const VotePillAbstain: Story = { }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); - await expect(canvas.getByText(/abstain/i)).toBeInTheDocument(); + await expect(canvas.getByText(/Abstain/i)).toBeInTheDocument(); }, };