Add test that dialog is opened when totalVotes are clicked
This commit is contained in:
parent
3730cb4653
commit
c53fea0b26
1 changed files with 20 additions and 0 deletions
|
@ -20,6 +20,8 @@ import {
|
|||
} from "matrix-js-sdk/src/matrix";
|
||||
import React from "react";
|
||||
|
||||
import Modal from "../../../../../src/Modal";
|
||||
import PollResultsDialog from "../../../../../src/components/views/dialogs/PollResultsDialog";
|
||||
import { IBodyProps } from "../../../../../src/components/views/messages/IBodyProps";
|
||||
import MPollBody, {
|
||||
allVotes,
|
||||
|
@ -863,6 +865,24 @@ describe("MPollBody", () => {
|
|||
const { container } = await newMPollBody(votes, ends, undefined, false);
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("opens the full results dialog when the total votes link is clicked", async () => {
|
||||
const votes = [
|
||||
responseEvent("@ed:example.com", "pizza", 12),
|
||||
responseEvent("@rf:example.com", "pizza", 12),
|
||||
responseEvent("@th:example.com", "wings", 13),
|
||||
];
|
||||
const ends = [newPollEndEvent("@me:example.com", 25)];
|
||||
const renderResult = await newMPollBody(votes, ends);
|
||||
const createDialogSpy = jest.spyOn(Modal, "createDialog");
|
||||
|
||||
fireEvent.click(renderResult.getByTestId("totalVotes"));
|
||||
|
||||
expect(createDialogSpy).toHaveBeenCalledWith(
|
||||
PollResultsDialog,
|
||||
expect.anything()
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function newVoteRelations(relationEvents: Array<MatrixEvent>): Relations {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue