Provide RoomViewStore from the RoomContext (#30980)
* Pass roomViewStore to the RoomView and add to the RoomContext. * lint * lint * Make constants more DRY * Make constants more DRY * Commend non-null assertion on roomViewStore property of the RoomContext * Update tsdocs.
This commit is contained in:
@@ -14,6 +14,7 @@ import { type IRoomState, MainSplitContentType } from "../../src/components/stru
|
||||
import { TimelineRenderingType } from "../../src/contexts/RoomContext";
|
||||
import { Layout } from "../../src/settings/enums/Layout";
|
||||
import { mkEvent } from "./test-utils";
|
||||
import { SdkContextClass } from "../../src/contexts/SDKContext";
|
||||
|
||||
export const makeMembershipEvent = (roomId: string, userId: string, membership = KnownMembership.Join) =>
|
||||
mkEvent({
|
||||
@@ -44,6 +45,7 @@ export const makeRoomWithStateEvents = (
|
||||
|
||||
export function getRoomContext(room: Room, override: Partial<IRoomState>): IRoomState {
|
||||
return {
|
||||
roomViewStore: SdkContextClass.instance.roomViewStore,
|
||||
room,
|
||||
roomLoading: true,
|
||||
peekLoading: false,
|
||||
|
||||
@@ -158,6 +158,7 @@ describe("RoomView", () => {
|
||||
threepidInvite={undefined as any}
|
||||
forceTimeline={false}
|
||||
ref={ref}
|
||||
roomViewStore={stores.roomViewStore}
|
||||
/>
|
||||
</SDKContext.Provider>
|
||||
</MatrixClientContext.Provider>,
|
||||
@@ -196,6 +197,7 @@ describe("RoomView", () => {
|
||||
threepidInvite={undefined}
|
||||
forceTimeline={false}
|
||||
onRegistered={jest.fn()}
|
||||
roomViewStore={stores.roomViewStore}
|
||||
/>
|
||||
</SDKContext.Provider>
|
||||
</MatrixClientContext.Provider>,
|
||||
|
||||
@@ -30,6 +30,7 @@ import { mockPlatformPeg } from "../../../../test-utils/platform";
|
||||
import { doMaybeLocalRoomAction } from "../../../../../src/utils/local-room";
|
||||
import { addTextToComposer } from "../../../../test-utils/composer";
|
||||
import { ScopedRoomContextProvider } from "../../../../../src/contexts/ScopedRoomContext.tsx";
|
||||
import { SdkContextClass } from "../../../../../src/contexts/SDKContext.ts";
|
||||
|
||||
jest.mock("../../../../../src/utils/local-room", () => ({
|
||||
doMaybeLocalRoomAction: jest.fn(),
|
||||
@@ -37,6 +38,7 @@ jest.mock("../../../../../src/utils/local-room", () => ({
|
||||
|
||||
describe("<SendMessageComposer/>", () => {
|
||||
const defaultRoomContext: IRoomState = {
|
||||
roomViewStore: SdkContextClass.instance.roomViewStore,
|
||||
roomLoading: true,
|
||||
peekLoading: false,
|
||||
shouldPeek: true,
|
||||
|
||||
Reference in New Issue
Block a user