Fix MessageComposer test

This commit is contained in:
Florian Duros 2022-10-24 15:03:18 +02:00
parent de86221c72
commit fda4dabf6d
No known key found for this signature in database
GPG key ID: 9700AA5870258A0B
2 changed files with 8 additions and 6 deletions

View file

@ -102,7 +102,7 @@ interface IState {
showVoiceBroadcastButton: boolean;
}
class MessageComposer extends React.Component<IProps, IState> {
export class MessageComposer extends React.Component<IProps, IState> {
private dispatcherRef?: string;
private messageComposerInput = createRef<SendMessageComposerClass>();
private voiceRecordingButton = createRef<VoiceRecordComposerTile>();

View file

@ -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,