User status in user menu (#33797)
* Add user status on user profile icon Currently unstyled & no tests * Style the user status icon * Update snapshot for avatar wrapper * More snapshot updates * add if braces * Split out user status functions to avoid circular dep which has the weird effect of just breaking jest's mocking. * type imports * Update imports * Update snapshot * Tests * baseline image * Just snapshot the component itself * User status in user menu first pass, unstyled * fix export * superstylin' * snapshots * Add story & test * Snapshots and re-use the repeated rules * Tests * Fix jest lcov projectRoot config * Change tooltip text to just 'clear' * Add comment & fix console warn * Remove all options screenshot as it's not really particularly useful as a preset story * remove stale screenshot * fix imports --------- Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
co-authored by
Michael Telatynski
parent
44c540eca0
commit
3ab233940c
@@ -27,6 +27,7 @@ describe("UserMenuViewModel", () => {
|
||||
...mockClientMethodsUser(),
|
||||
...mockClientMethodsServer(),
|
||||
getAuthMetadata: jest.fn().mockRejectedValue(new MatrixError({ errcode: "M_UNRECOGNIZED" }, 404)),
|
||||
setExtendedProfileProperty: jest.fn().mockResolvedValue(undefined),
|
||||
});
|
||||
SdkContextClass.instance.client = client;
|
||||
});
|
||||
@@ -153,6 +154,15 @@ describe("UserMenuViewModel", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("can clear a user status", async () => {
|
||||
const vm = new UserMenuViewModel(dispatcher, client, true);
|
||||
vm.setOpen(true);
|
||||
vm.clearStatus();
|
||||
await waitFor(() =>
|
||||
expect(client.setExtendedProfileProperty).toHaveBeenCalledWith("org.matrix.msc4426.status", null),
|
||||
);
|
||||
});
|
||||
|
||||
it("should be able to open the createAccount screen as a guest", async () => {
|
||||
client.isGuest.mockReturnValue(true);
|
||||
const dispatcherSpy = jest.fn();
|
||||
|
||||
Reference in New Issue
Block a user