Remove more usages of singleton store getter in favour of contexts (#34099)
* 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 * Remove more usages of singleton store getter in favour of contexts * Remove more usages of singleton store getter in favour of contexts * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests * Fix tests * Fix tests * Iterate * Fix bad merge * Iterate * Fix tests * Iterate * Iterate * Iterate * Iterate * Iterate * Improve coverage * Improve coverage
This commit is contained in:
@@ -46,6 +46,7 @@ import Modal from "../../../../src/Modal";
|
||||
import { SETTINGS } from "../../../../src/settings/Settings";
|
||||
import ToastStore from "../../../../src/stores/ToastStore";
|
||||
import { ModuleApi } from "../../../../src/modules/Api";
|
||||
import { fireEvent } from "@testing-library/dom";
|
||||
|
||||
describe("<LoggedInView />", () => {
|
||||
const userId = "@alice:domain.org";
|
||||
@@ -67,6 +68,8 @@ describe("<LoggedInView />", () => {
|
||||
on: jest.fn(),
|
||||
},
|
||||
getAuthMetadata: jest.fn().mockRejectedValue(new Error("Legacy auth")),
|
||||
hasLazyLoadMembersEnabled: jest.fn(),
|
||||
isInitialSyncComplete: jest.fn(),
|
||||
});
|
||||
const mediaHandler = new MediaHandler(mockClient);
|
||||
const mockSdkContext = new TestSDKContext();
|
||||
@@ -555,4 +558,11 @@ describe("<LoggedInView />", () => {
|
||||
expect(container.querySelector(".mx_SpacePanel")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it("should handle KeyBindingAction.ToggleRoomSidePanel", async () => {
|
||||
getComponent({ page_type: "room_view" });
|
||||
jest.spyOn(mockSdkContext.rightPanelStore, "togglePanel");
|
||||
fireEvent.keyDown(document.body, { key: ".", code: "Period", ctrlKey: true, keyCode: 190 });
|
||||
expect(mockSdkContext.rightPanelStore.togglePanel).toHaveBeenCalledWith(null);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user