Fix existing tests but 3
This commit is contained in:
parent
6b92c92531
commit
2083213131
5 changed files with 685 additions and 203 deletions
|
@ -367,8 +367,8 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div data-testid="totalVotes" className="mx_MPollBody_totalVotes">
|
<div className="mx_MPollBody_totalVotes">
|
||||||
<span onClick={() => showDetailedVotes()}>{totalText}</span>
|
<span data-testid="totalVotes" onClick={() => showDetailedVotes()}>{totalText}</span>
|
||||||
{isFetchingResponses && <Spinner w={16} h={16} />}
|
{isFetchingResponses && <Spinner w={16} h={16} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,7 +12,6 @@ import React, { ReactNode, useContext } from "react";
|
||||||
|
|
||||||
import { Icon as TrophyIcon } from "../../../../res/img/element-icons/trophy.svg";
|
import { Icon as TrophyIcon } from "../../../../res/img/element-icons/trophy.svg";
|
||||||
import RoomContext from "../../../contexts/RoomContext";
|
import RoomContext from "../../../contexts/RoomContext";
|
||||||
import { useRoomMembers } from "../../../hooks/useRoomMembers";
|
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import FacePile from "../elements/FacePile";
|
import FacePile from "../elements/FacePile";
|
||||||
import StyledRadioButton from "../elements/StyledRadioButton";
|
import StyledRadioButton from "../elements/StyledRadioButton";
|
||||||
|
@ -28,13 +27,13 @@ type PollOptionContentProps = {
|
||||||
};
|
};
|
||||||
const PollOptionContent: React.FC<PollOptionContentProps> = ({ isWinner, answer, votes, displayVoteCount }) => {
|
const PollOptionContent: React.FC<PollOptionContentProps> = ({ isWinner, answer, votes, displayVoteCount }) => {
|
||||||
const votesText = displayVoteCount ? _t("timeline|m.poll|count_of_votes", { count: votes.length }) : "";
|
const votesText = displayVoteCount ? _t("timeline|m.poll|count_of_votes", { count: votes.length }) : "";
|
||||||
const room = useContext(RoomContext).room!;
|
const room = useContext(RoomContext).room;
|
||||||
const members = useRoomMembers(room);
|
const members = room?.getJoinedMembers() || [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_PollOption_content">
|
<div className="mx_PollOption_content">
|
||||||
<div className="mx_PollOption_optionText">{answer.text}</div>
|
<div className="mx_PollOption_optionText">{answer.text}</div>
|
||||||
<div className="mx_PollOption_optionVoteCount">
|
<div>
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
{displayVoteCount
|
{displayVoteCount
|
||||||
&& members.length <= MAXIMUM_MEMBERS_FOR_FACE_PILE
|
&& members.length <= MAXIMUM_MEMBERS_FOR_FACE_PILE
|
||||||
|
@ -45,7 +44,7 @@ const PollOptionContent: React.FC<PollOptionContentProps> = ({ isWinner, answer,
|
||||||
style={{ marginRight: "10px" }}
|
style={{ marginRight: "10px" }}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<span>
|
<span className="mx_PollOption_optionVoteCount">
|
||||||
{isWinner && <TrophyIcon className="mx_PollOption_winnerIcon" />}
|
{isWinner && <TrophyIcon className="mx_PollOption_winnerIcon" />}
|
||||||
{votesText}
|
{votesText}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1727,8 +1727,8 @@
|
||||||
"other": "%(count)s votes cast. Vote to see the results"
|
"other": "%(count)s votes cast. Vote to see the results"
|
||||||
},
|
},
|
||||||
"total_n_votes_voted": {
|
"total_n_votes_voted": {
|
||||||
"one": "Based on %(count)s vote. Click here to see the results",
|
"one": "Based on %(count)s vote. Click here to see full results",
|
||||||
"other": "Based on %(count)s votes. Click here to see the results"
|
"other": "Based on %(count)s votes. Click here to see full results"
|
||||||
},
|
},
|
||||||
"total_no_votes": "No votes cast",
|
"total_no_votes": "No votes cast",
|
||||||
"total_not_ended": "Results will be visible when the poll is ended",
|
"total_not_ended": "Results will be visible when the poll is ended",
|
||||||
|
@ -1879,8 +1879,8 @@
|
||||||
"other": "There are no past polls for the past %(count)s days. Load more polls to view polls for previous months"
|
"other": "There are no past polls for the past %(count)s days. Load more polls to view polls for previous months"
|
||||||
},
|
},
|
||||||
"final_result": {
|
"final_result": {
|
||||||
"one": "Final result based on %(count)s vote. Click here to see the results",
|
"one": "Final result based on %(count)s vote. Click here to see full results",
|
||||||
"other": "Final result based on %(count)s votes. Click here to see the results"
|
"other": "Final result based on %(count)s votes. Click here to see full results"
|
||||||
},
|
},
|
||||||
"load_more": "Load more polls",
|
"load_more": "Load more polls",
|
||||||
"loading": "Loading polls",
|
"loading": "Loading polls",
|
||||||
|
|
|
@ -6,26 +6,30 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react";
|
|
||||||
import { fireEvent, render, RenderResult } from "jest-matrix-react";
|
import { fireEvent, render, RenderResult } from "jest-matrix-react";
|
||||||
import {
|
import {
|
||||||
MatrixEvent,
|
|
||||||
Relations,
|
|
||||||
M_POLL_KIND_DISCLOSED,
|
M_POLL_KIND_DISCLOSED,
|
||||||
M_POLL_KIND_UNDISCLOSED,
|
M_POLL_KIND_UNDISCLOSED,
|
||||||
M_POLL_RESPONSE,
|
M_POLL_RESPONSE,
|
||||||
M_POLL_START,
|
M_POLL_START,
|
||||||
PollStartEventContent,
|
|
||||||
PollAnswer,
|
|
||||||
M_TEXT,
|
M_TEXT,
|
||||||
|
MatrixEvent,
|
||||||
|
PollAnswer,
|
||||||
|
PollStartEventContent,
|
||||||
|
Relations
|
||||||
} from "matrix-js-sdk/src/matrix";
|
} from "matrix-js-sdk/src/matrix";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import { IBodyProps } from "../../../../../src/components/views/messages/IBodyProps";
|
||||||
import MPollBody, {
|
import MPollBody, {
|
||||||
allVotes,
|
allVotes,
|
||||||
findTopAnswer,
|
findTopAnswer,
|
||||||
isPollEnded,
|
isPollEnded,
|
||||||
} from "../../../../../src/components/views/messages/MPollBody";
|
} from "../../../../../src/components/views/messages/MPollBody";
|
||||||
import { IBodyProps } from "../../../../../src/components/views/messages/IBodyProps";
|
import MatrixClientContext from "../../../../../src/contexts/MatrixClientContext";
|
||||||
|
import * as languageHandler from "../../../../../src/languageHandler";
|
||||||
|
import { MediaEventHelper } from "../../../../../src/utils/MediaEventHelper";
|
||||||
|
import { RoomPermalinkCreator } from "../../../../../src/utils/permalinks/Permalinks";
|
||||||
import {
|
import {
|
||||||
flushPromises,
|
flushPromises,
|
||||||
getMockClientWithEventEmitter,
|
getMockClientWithEventEmitter,
|
||||||
|
@ -33,10 +37,6 @@ import {
|
||||||
mockClientMethodsUser,
|
mockClientMethodsUser,
|
||||||
setupRoomWithPollEvents,
|
setupRoomWithPollEvents,
|
||||||
} from "../../../../test-utils";
|
} from "../../../../test-utils";
|
||||||
import MatrixClientContext from "../../../../../src/contexts/MatrixClientContext";
|
|
||||||
import { RoomPermalinkCreator } from "../../../../../src/utils/permalinks/Permalinks";
|
|
||||||
import { MediaEventHelper } from "../../../../../src/utils/MediaEventHelper";
|
|
||||||
import * as languageHandler from "../../../../../src/languageHandler";
|
|
||||||
|
|
||||||
const CHECKED = "mx_PollOption_checked";
|
const CHECKED = "mx_PollOption_checked";
|
||||||
const userId = "@me:example.com";
|
const userId = "@me:example.com";
|
||||||
|
@ -99,7 +99,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 4 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 4 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("ignores end poll events from unauthorised users", async () => {
|
it("ignores end poll events from unauthorised users", async () => {
|
||||||
|
@ -118,7 +118,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 4 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 4 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("hides scores if I have not voted", async () => {
|
it("hides scores if I have not voted", async () => {
|
||||||
|
@ -159,7 +159,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses my local vote", async () => {
|
it("uses my local vote", async () => {
|
||||||
|
@ -180,7 +180,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "italian")).toBe("1 vote");
|
expect(votesCount(renderResult, "italian")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
||||||
|
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 4 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 4 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("overrides my other votes with my local vote", async () => {
|
it("overrides my other votes with my local vote", async () => {
|
||||||
|
@ -202,7 +202,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "italian")).toBe("1 vote");
|
expect(votesCount(renderResult, "italian")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
|
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes. Click here to see full results");
|
||||||
|
|
||||||
// And my vote is highlighted
|
// And my vote is highlighted
|
||||||
expect(voteButton(renderResult, "wings").className.includes(CHECKED)).toBe(true);
|
expect(voteButton(renderResult, "wings").className.includes(CHECKED)).toBe(true);
|
||||||
|
@ -234,7 +234,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
|
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 1 vote");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 1 vote. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("doesn't cancel my local vote if someone else votes", async () => {
|
it("doesn't cancel my local vote if someone else votes", async () => {
|
||||||
|
@ -266,7 +266,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
|
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes. Click here to see full results");
|
||||||
|
|
||||||
// And my vote is highlighted
|
// And my vote is highlighted
|
||||||
expect(voteButton(renderResult, "pizza").className.includes(CHECKED)).toBe(true);
|
expect(voteButton(renderResult, "pizza").className.includes(CHECKED)).toBe(true);
|
||||||
|
@ -293,7 +293,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
expect(votesCount(renderResult, "wings")).toBe("1 vote");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows un-voting by passing an empty vote", async () => {
|
it("allows un-voting by passing an empty vote", async () => {
|
||||||
|
@ -307,7 +307,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("1 vote");
|
expect(votesCount(renderResult, "italian")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 1 vote");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 1 vote. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows re-voting after un-voting", async () => {
|
it("allows re-voting after un-voting", async () => {
|
||||||
|
@ -322,7 +322,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("2 votes");
|
expect(votesCount(renderResult, "italian")).toBe("2 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 2 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("treats any invalid answer as a spoiled ballot", async () => {
|
it("treats any invalid answer as a spoiled ballot", async () => {
|
||||||
|
@ -340,7 +340,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(votesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 0 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 0 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows re-voting after a spoiled ballot", async () => {
|
it("allows re-voting after a spoiled ballot", async () => {
|
||||||
|
@ -357,7 +357,7 @@ describe("MPollBody", () => {
|
||||||
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
expect(votesCount(renderResult, "poutine")).toBe("1 vote");
|
||||||
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
expect(votesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
expect(votesCount(renderResult, "wings")).toBe("0 votes");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 1 vote");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Based on 1 vote. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders nothing if poll has no answers", async () => {
|
it("renders nothing if poll has no answers", async () => {
|
||||||
|
@ -526,7 +526,7 @@ describe("MPollBody", () => {
|
||||||
expect(endedVotesCount(renderResult, "poutine")).toBe('<div class="mx_PollOption_winnerIcon"></div>1 vote');
|
expect(endedVotesCount(renderResult, "poutine")).toBe('<div class="mx_PollOption_winnerIcon"></div>1 vote');
|
||||||
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>1 vote');
|
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>1 vote');
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 2 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 2 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("counts a single vote as normal if the poll is ended", async () => {
|
it("counts a single vote as normal if the poll is ended", async () => {
|
||||||
|
@ -537,7 +537,7 @@ describe("MPollBody", () => {
|
||||||
expect(endedVotesCount(renderResult, "poutine")).toBe('<div class="mx_PollOption_winnerIcon"></div>1 vote');
|
expect(endedVotesCount(renderResult, "poutine")).toBe('<div class="mx_PollOption_winnerIcon"></div>1 vote');
|
||||||
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "wings")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "wings")).toBe("0 votes");
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 1 vote");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 1 vote. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows ended vote counts of different numbers", async () => {
|
it("shows ended vote counts of different numbers", async () => {
|
||||||
|
@ -557,7 +557,7 @@ describe("MPollBody", () => {
|
||||||
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("ignores votes that arrived after poll ended", async () => {
|
it("ignores votes that arrived after poll ended", async () => {
|
||||||
|
@ -577,7 +577,7 @@ describe("MPollBody", () => {
|
||||||
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("counts votes that arrived after an unauthorised poll end event", async () => {
|
it("counts votes that arrived after an unauthorised poll end event", async () => {
|
||||||
|
@ -600,7 +600,7 @@ describe("MPollBody", () => {
|
||||||
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("ignores votes that arrived after the first end poll event", async () => {
|
it("ignores votes that arrived after the first end poll event", async () => {
|
||||||
|
@ -627,7 +627,7 @@ describe("MPollBody", () => {
|
||||||
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "poutine")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
expect(endedVotesCount(renderResult, "italian")).toBe("0 votes");
|
||||||
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
expect(endedVotesCount(renderResult, "wings")).toBe('<div class="mx_PollOption_winnerIcon"></div>3 votes');
|
||||||
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes");
|
expect(renderResult.getByTestId("totalVotes").innerHTML).toBe("Final result based on 5 votes. Click here to see full results");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("highlights the winning vote in an ended poll", async () => {
|
it("highlights the winning vote in an ended poll", async () => {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue