Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
correct test to use keyboard event
Browse files Browse the repository at this point in the history
  • Loading branch information
Alun Turner committed Jan 12, 2023
1 parent 3b11e0f commit 93cbc0a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
import "@testing-library/jest-dom";
import React from "react";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";

import { WysiwygComposer } from "../../../../../../src/components/views/rooms/wysiwyg_composer/components/WysiwygComposer";
import SettingsStore from "../../../../../../src/settings/SettingsStore";
Expand Down Expand Up @@ -91,7 +90,13 @@ describe("WysiwygComposer", () => {

it("Should not call onSend when shift + Enter is pressed ", async () => {
//When
userEvent.type(screen.getByRole("textbox"), "{Shift>}{Enter}");
fireEvent(
screen.getByRole("textbox"),
new KeyboardEvent("keyDown", {
key: "Enter",
shiftKey: true,
}),
);

// Then it does not send a message
await waitFor(() => expect(onSend).toBeCalledTimes(0));
Expand Down

0 comments on commit 93cbc0a

Please sign in to comment.