Fix MessageComposer test

pull/28788/head^2
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; showVoiceBroadcastButton: boolean;
} }
class MessageComposer extends React.Component<IProps, IState> { export class MessageComposer extends React.Component<IProps, IState> {
private dispatcherRef?: string; private dispatcherRef?: string;
private messageComposerInput = createRef<SendMessageComposerClass>(); private messageComposerInput = createRef<SendMessageComposerClass>();
private voiceRecordingButton = createRef<VoiceRecordComposerTile>(); 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 { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread";
import { createTestClient, mkEvent, mkStubRoom, stubClient } from "../../../test-utils"; 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 MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg"; import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
import RoomContext from "../../../../src/contexts/RoomContext"; import RoomContext from "../../../../src/contexts/RoomContext";
@ -106,7 +107,7 @@ describe("MessageComposer", () => {
it("should call notifyTimelineHeightChanged() for the same context", () => { it("should call notifyTimelineHeightChanged() for the same context", () => {
dis.dispatch({ dis.dispatch({
action: "reply_to_event", action: "reply_to_event",
context: (wrapper.instance as unknown as MessageComposer).context, context: (wrapper.instance as unknown as MessageComposerClass).context,
}); });
wrapper.update(); wrapper.update();
@ -207,7 +208,7 @@ describe("MessageComposer", () => {
let stateBefore: any; let stateBefore: any;
beforeEach(() => { beforeEach(() => {
wrapper = wrapAndRender({ room }); wrapper = wrapAndRender({ room }).children();
stateBefore = { ...wrapper.instance().state }; stateBefore = { ...wrapper.instance().state };
resizeCallback("test", {}); resizeCallback("test", {});
wrapper.update(); wrapper.update();
@ -220,7 +221,8 @@ describe("MessageComposer", () => {
describe("when a resize to narrow event occurred in UIStore", () => { describe("when a resize to narrow event occurred in UIStore", () => {
beforeEach(() => { beforeEach(() => {
wrapper = wrapAndRender({ room }, true, true); wrapper = wrapAndRender({ room }, true, true).children();
wrapper.setState({ wrapper.setState({
isMenuOpen: true, isMenuOpen: true,
isStickerPickerOpen: true, isStickerPickerOpen: true,
@ -240,7 +242,7 @@ describe("MessageComposer", () => {
describe("when a resize to non-narrow event occurred in UIStore", () => { describe("when a resize to non-narrow event occurred in UIStore", () => {
beforeEach(() => { beforeEach(() => {
wrapper = wrapAndRender({ room }, true, false); wrapper = wrapAndRender({ room }, true, false).children();
wrapper.setState({ wrapper.setState({
isMenuOpen: true, isMenuOpen: true,
isStickerPickerOpen: true, isStickerPickerOpen: true,