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

Commit 93cbc0a

Browse files
author
Alun Turner
committed
correct test to use keyboard event
1 parent 3b11e0f commit 93cbc0a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/components/views/rooms/wysiwyg_composer/components/WysiwygComposer-test.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
import "@testing-library/jest-dom";
1818
import React from "react";
1919
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
20-
import userEvent from "@testing-library/user-event";
2120

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

9291
it("Should not call onSend when shift + Enter is pressed ", async () => {
9392
//When
94-
userEvent.type(screen.getByRole("textbox"), "{Shift>}{Enter}");
93+
fireEvent(
94+
screen.getByRole("textbox"),
95+
new KeyboardEvent("keyDown", {
96+
key: "Enter",
97+
shiftKey: true,
98+
}),
99+
);
95100

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

0 commit comments

Comments
 (0)