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:
@@ -21,6 +21,7 @@ import {
|
||||
RoomMember,
|
||||
RoomStateEvent,
|
||||
SearchResult,
|
||||
User,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { type CryptoApi, CryptoEvent, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
@@ -1132,6 +1133,54 @@ describe("RoomView", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should handle Action.ViewUser", async () => {
|
||||
await mountRoomView();
|
||||
jest.spyOn(stores.rightPanelStore, "setCards");
|
||||
const member = new User("@user:server");
|
||||
defaultDispatcher.dispatch(
|
||||
{
|
||||
action: Action.ViewUser,
|
||||
member,
|
||||
},
|
||||
true,
|
||||
);
|
||||
expect(stores.rightPanelStore.setCards).toHaveBeenCalledWith([
|
||||
{ phase: RightPanelPhases.RoomSummary },
|
||||
{ phase: RightPanelPhases.MemberList },
|
||||
{ phase: RightPanelPhases.MemberInfo, state: { member } },
|
||||
]);
|
||||
});
|
||||
|
||||
it("should handle Action.ViewUser with push", async () => {
|
||||
await mountRoomView();
|
||||
jest.spyOn(stores.rightPanelStore, "pushCard");
|
||||
const member = new User("@user:server");
|
||||
defaultDispatcher.dispatch(
|
||||
{
|
||||
action: Action.ViewUser,
|
||||
member,
|
||||
push: true,
|
||||
},
|
||||
true,
|
||||
);
|
||||
expect(stores.rightPanelStore.pushCard).toHaveBeenCalledWith({
|
||||
phase: RightPanelPhases.MemberInfo,
|
||||
state: { member },
|
||||
});
|
||||
});
|
||||
|
||||
it("should handle Action.View3pidInvite", async () => {
|
||||
await mountRoomView();
|
||||
jest.spyOn(stores.rightPanelStore, "showOrHidePhase");
|
||||
defaultDispatcher.dispatch(
|
||||
{
|
||||
action: Action.View3pidInvite,
|
||||
},
|
||||
true,
|
||||
);
|
||||
expect(stores.rightPanelStore.showOrHidePhase).toHaveBeenCalledWith("MemberList");
|
||||
});
|
||||
|
||||
describe("when there is a RoomView", () => {
|
||||
const widget1Id = "widget1";
|
||||
const widget2Id = "widget2";
|
||||
|
||||
Reference in New Issue
Block a user