From fda4dabf6d79ac5badfd736cd652b56cd59dd710 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Mon, 24 Oct 2022 15:03:18 +0200 Subject: [PATCH] Fix MessageComposer test --- src/components/views/rooms/MessageComposer.tsx | 2 +- test/components/views/rooms/MessageComposer-test.tsx | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index 60bc5ee641..674635d896 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -102,7 +102,7 @@ interface IState { showVoiceBroadcastButton: boolean; } -class MessageComposer extends React.Component { +export class MessageComposer extends React.Component { private dispatcherRef?: string; private messageComposerInput = createRef(); private voiceRecordingButton = createRef(); diff --git a/test/components/views/rooms/MessageComposer-test.tsx b/test/components/views/rooms/MessageComposer-test.tsx index 066d97e683..debeb7b5e6 100644 --- a/test/components/views/rooms/MessageComposer-test.tsx +++ b/test/components/views/rooms/MessageComposer-test.tsx @@ -21,7 +21,8 @@ import { MatrixEvent, MsgType, RoomMember } from "matrix-js-sdk/src/matrix"; import { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread"; import { createTestClient, mkEvent, mkStubRoom, stubClient } from "../../../test-utils"; -import MessageComposer from "../../../../src/components/views/rooms/MessageComposer"; +import MessageComposer, { MessageComposer as MessageComposerClass } + from "../../../../src/components/views/rooms/MessageComposer"; import MatrixClientContext from "../../../../src/contexts/MatrixClientContext"; import { MatrixClientPeg } from "../../../../src/MatrixClientPeg"; import RoomContext from "../../../../src/contexts/RoomContext"; @@ -106,7 +107,7 @@ describe("MessageComposer", () => { it("should call notifyTimelineHeightChanged() for the same context", () => { dis.dispatch({ action: "reply_to_event", - context: (wrapper.instance as unknown as MessageComposer).context, + context: (wrapper.instance as unknown as MessageComposerClass).context, }); wrapper.update(); @@ -207,7 +208,7 @@ describe("MessageComposer", () => { let stateBefore: any; beforeEach(() => { - wrapper = wrapAndRender({ room }); + wrapper = wrapAndRender({ room }).children(); stateBefore = { ...wrapper.instance().state }; resizeCallback("test", {}); wrapper.update(); @@ -220,7 +221,8 @@ describe("MessageComposer", () => { describe("when a resize to narrow event occurred in UIStore", () => { beforeEach(() => { - wrapper = wrapAndRender({ room }, true, true); + wrapper = wrapAndRender({ room }, true, true).children(); + wrapper.setState({ isMenuOpen: true, isStickerPickerOpen: true, @@ -240,7 +242,7 @@ describe("MessageComposer", () => { describe("when a resize to non-narrow event occurred in UIStore", () => { beforeEach(() => { - wrapper = wrapAndRender({ room }, true, false); + wrapper = wrapAndRender({ room }, true, false).children(); wrapper.setState({ isMenuOpen: true, isStickerPickerOpen: true,