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:
Kerry 2022-12-29 15:08:57 +13:00 committed by GitHub
parent 2e097a00c7
commit c0ba1b8a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 8 deletions

View file

@ -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,
);
});
});
});