You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-09 08:42:50 +03:00
Device manager - contextual menus (#9832)
* add session count to current session contextual signout * add contextual menu to other sessions section * typo * i18n * strict
This commit is contained in:
@@ -42,6 +42,7 @@ describe("<CurrentDeviceSection />", () => {
|
||||
saveDeviceName: jest.fn(),
|
||||
isLoading: false,
|
||||
isSigningOut: false,
|
||||
otherSessionsCount: 1,
|
||||
};
|
||||
|
||||
const getComponent = (props = {}): React.ReactElement => <CurrentDeviceSection {...defaultProps} {...props} />;
|
||||
|
@@ -643,7 +643,7 @@ describe("<SessionManagerTab />", () => {
|
||||
});
|
||||
|
||||
fireEvent.click(getByTestId("current-session-menu"));
|
||||
expect(queryByLabelText("Sign out all other sessions")).toBeFalsy();
|
||||
expect(queryByLabelText("Sign out of all other sessions")).toBeFalsy();
|
||||
});
|
||||
|
||||
it("signs out of all other devices from current session context menu", async () => {
|
||||
@@ -657,7 +657,7 @@ describe("<SessionManagerTab />", () => {
|
||||
});
|
||||
|
||||
fireEvent.click(getByTestId("current-session-menu"));
|
||||
fireEvent.click(getByLabelText("Sign out all other sessions"));
|
||||
fireEvent.click(getByLabelText("Sign out of all other sessions (2)"));
|
||||
await confirmSignout(getByTestId);
|
||||
|
||||
// other devices deleted, excluding current device
|
||||
@@ -928,6 +928,27 @@ describe("<SessionManagerTab />", () => {
|
||||
|
||||
resolveDeleteRequest?.();
|
||||
});
|
||||
|
||||
it("signs out of all other devices from other sessions context menu", async () => {
|
||||
mockClient.getDevices.mockResolvedValue({
|
||||
devices: [alicesDevice, alicesMobileDevice, alicesOlderMobileDevice],
|
||||
});
|
||||
const { getByTestId, getByLabelText } = render(getComponent());
|
||||
|
||||
await act(async () => {
|
||||
await flushPromises();
|
||||
});
|
||||
|
||||
fireEvent.click(getByTestId("other-sessions-menu"));
|
||||
fireEvent.click(getByLabelText("Sign out of 2 sessions"));
|
||||
await confirmSignout(getByTestId);
|
||||
|
||||
// other devices deleted, excluding current device
|
||||
expect(mockClient.deleteMultipleDevices).toHaveBeenCalledWith(
|
||||
[alicesMobileDevice.device_id, alicesOlderMobileDevice.device_id],
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user