You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
Remove legacy consumers of the RoomContext in favour of HOCs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ import React, { createRef } from "react";
|
||||
import { Mocked, mocked } from "jest-mock";
|
||||
import { forEachRight } from "lodash";
|
||||
|
||||
import TimelinePanel from "../../../src/components/structures/TimelinePanel";
|
||||
import TimelinePanel, { TimelinePanel as TimelinePanelClass } from "../../../src/components/structures/TimelinePanel";
|
||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||
import { MatrixClientPeg } from "../../../src/MatrixClientPeg";
|
||||
import { isCallEvent } from "../../../src/components/structures/LegacyCallEventGrouper";
|
||||
@@ -77,7 +77,7 @@ const mkTimeline = (room: Room, events: MatrixEvent[]): [EventTimeline, EventTim
|
||||
return [timeline, timelineSet];
|
||||
};
|
||||
|
||||
const getProps = (room: Room, events: MatrixEvent[]): TimelinePanel["props"] => {
|
||||
const getProps = (room: Room, events: MatrixEvent[]): React.ComponentProps<typeof TimelinePanel> => {
|
||||
const [, timelineSet] = mkTimeline(room, events);
|
||||
|
||||
return {
|
||||
@@ -184,7 +184,7 @@ describe("TimelinePanel", () => {
|
||||
const roomId = "#room:example.com";
|
||||
let room: Room;
|
||||
let timelineSet: EventTimelineSet;
|
||||
let timelinePanel: TimelinePanel;
|
||||
let timelinePanel: React.ComponentRef<typeof TimelinePanel>;
|
||||
|
||||
const ev1 = new MatrixEvent({
|
||||
event_id: "ev1",
|
||||
@@ -203,7 +203,7 @@ describe("TimelinePanel", () => {
|
||||
});
|
||||
|
||||
const renderTimelinePanel = async (): Promise<void> => {
|
||||
const ref = createRef<TimelinePanel>();
|
||||
const ref = createRef<React.ComponentRef<typeof TimelinePanel>>();
|
||||
render(
|
||||
<TimelinePanel
|
||||
timelineSet={timelineSet}
|
||||
@@ -239,7 +239,7 @@ describe("TimelinePanel", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TimelinePanel.roomReadMarkerTsMap = {};
|
||||
TimelinePanelClass.roomReadMarkerTsMap = {};
|
||||
});
|
||||
|
||||
it("when there is no event, it should not send any receipt", async () => {
|
||||
|
@@ -50,7 +50,7 @@ import {
|
||||
} from "../../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
import RoomHeader, { IProps as RoomHeaderProps } from "../../../../src/components/views/rooms/LegacyRoomHeader";
|
||||
import RoomHeader from "../../../../src/components/views/rooms/LegacyRoomHeader";
|
||||
import { SearchScope } from "../../../../src/components/views/rooms/SearchBar";
|
||||
import { E2EStatus } from "../../../../src/utils/ShieldUtils";
|
||||
import { IRoomState } from "../../../../src/components/structures/RoomView";
|
||||
@@ -201,7 +201,10 @@ describe("LegacyRoomHeader", () => {
|
||||
WidgetMessagingStore.instance.stopMessaging(widget, call.roomId);
|
||||
};
|
||||
|
||||
const renderHeader = (props: Partial<RoomHeaderProps> = {}, roomContext: Partial<IRoomState> = {}) => {
|
||||
const renderHeader = (
|
||||
props: Partial<React.ComponentProps<typeof RoomHeader>> = {},
|
||||
roomContext: Partial<IRoomState> = {},
|
||||
) => {
|
||||
render(
|
||||
<RoomContext.Provider value={{ ...roomContext, room } as IRoomState}>
|
||||
<RoomHeader
|
||||
@@ -843,7 +846,7 @@ function createRoom(info: IRoomCreationInfo) {
|
||||
}
|
||||
|
||||
function mountHeader(room: Room, propsOverride = {}, roomContext?: Partial<IRoomState>): RenderResult {
|
||||
const props: RoomHeaderProps = {
|
||||
const props: React.ComponentProps<typeof RoomHeader> = {
|
||||
room,
|
||||
inRoom: true,
|
||||
onSearchClick: () => {},
|
||||
|
@@ -43,7 +43,7 @@ jest.mock("../../../../src/stores/VoiceRecordingStore", () => ({
|
||||
}));
|
||||
|
||||
describe("<VoiceRecordComposerTile/>", () => {
|
||||
let voiceRecordComposerTile: RefObject<VoiceRecordComposerTile>;
|
||||
let voiceRecordComposerTile: RefObject<React.ComponentRef<typeof VoiceRecordComposerTile>>;
|
||||
let mockRecorder: VoiceMessageRecording;
|
||||
let mockUpload: IUpload;
|
||||
let mockClient: MatrixClient;
|
||||
|
@@ -60,7 +60,7 @@ describe("WysiwygAutocomplete", () => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
const autocompleteRef = createRef<Autocomplete>();
|
||||
const autocompleteRef = createRef<React.ComponentRef<typeof Autocomplete>>();
|
||||
const getCompletionsSpy = jest.spyOn(Autocompleter.prototype, "getCompletions").mockResolvedValue([
|
||||
{
|
||||
completions: mockCompletion,
|
||||
|
Reference in New Issue
Block a user