Expose SDKContext on the window & avoid using singleton store .instance (#34098)
* Expose SDKContextClass via window for debugging * Remove stores from window if they are exposed via sdkContext * Avoid usages of global store instance where React context is accessible * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Iterate * Discard changes to apps/web/src/components/views/elements/AppTile.tsx
This commit is contained in:
@@ -35,6 +35,7 @@ import { addTextToComposer } from "../../../../test-utils/composer";
|
||||
import { ScopedRoomContextProvider } from "../../../../../src/contexts/ScopedRoomContext.tsx";
|
||||
import { SDKContextClass } from "../../../../../src/contexts/SDKContextClass";
|
||||
import { RoomUploadContextProvider } from "../../../../../src/viewmodels/room/RoomUploadViewModel.tsx";
|
||||
import { SDKContext } from "../../../../../src/contexts/SDKContext.ts";
|
||||
|
||||
jest.mock("../../../../../src/utils/local-room", () => ({
|
||||
doMaybeLocalRoomAction: jest.fn(),
|
||||
@@ -199,7 +200,11 @@ describe("<SendMessageComposer/>", () => {
|
||||
</MatrixClientContext.Provider>
|
||||
);
|
||||
const getComponent = (props = {}, roomContext = defaultRoomContext, client = mockClient) => {
|
||||
return render(getRawComponent(props, roomContext, client));
|
||||
return render(getRawComponent(props, roomContext, client), {
|
||||
wrapper: ({ children }) => (
|
||||
<SDKContext.Provider value={SDKContextClass.instance}>{children}</SDKContext.Provider>
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
it("renders text and placeholder correctly", () => {
|
||||
@@ -447,6 +452,11 @@ describe("<SendMessageComposer/>", () => {
|
||||
</RoomUploadContextProvider>
|
||||
</ScopedRoomContextProvider>
|
||||
</MatrixClientContext.Provider>,
|
||||
{
|
||||
wrapper: ({ children }) => (
|
||||
<SDKContext.Provider value={SDKContextClass.instance}>{children}</SDKContext.Provider>
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
const composer = container.querySelector<HTMLDivElement>(".mx_BasicMessageComposer_input")!;
|
||||
|
||||
Reference in New Issue
Block a user