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 - add spinners while devices are signing out (#9433)
This commit is contained in:
@@ -69,7 +69,7 @@ describe('<SessionManagerTab />', () => {
|
||||
};
|
||||
|
||||
const alicesInactiveDevice = {
|
||||
device_id: 'alices_older_mobile_device',
|
||||
device_id: 'alices_older_inactive_mobile_device',
|
||||
last_seen_ts: Date.now() - (INACTIVE_DEVICE_AGE_MS + 1000),
|
||||
};
|
||||
|
||||
@@ -105,7 +105,7 @@ describe('<SessionManagerTab />', () => {
|
||||
const toggleDeviceDetails = (
|
||||
getByTestId: ReturnType<typeof render>['getByTestId'],
|
||||
deviceId: ExtendedDevice['device_id'],
|
||||
) => {
|
||||
): void => {
|
||||
// open device detail
|
||||
const tile = getByTestId(`device-tile-${deviceId}`);
|
||||
const toggle = tile.querySelector('[aria-label="Toggle device details"]') as Element;
|
||||
@@ -115,11 +115,18 @@ describe('<SessionManagerTab />', () => {
|
||||
const toggleDeviceSelection = (
|
||||
getByTestId: ReturnType<typeof render>['getByTestId'],
|
||||
deviceId: ExtendedDevice['device_id'],
|
||||
) => {
|
||||
): void => {
|
||||
const checkbox = getByTestId(`device-tile-checkbox-${deviceId}`);
|
||||
fireEvent.click(checkbox);
|
||||
};
|
||||
|
||||
const getDeviceTile = (
|
||||
getByTestId: ReturnType<typeof render>['getByTestId'],
|
||||
deviceId: ExtendedDevice['device_id'],
|
||||
): HTMLElement => {
|
||||
return getByTestId(`device-tile-${deviceId}`);
|
||||
};
|
||||
|
||||
const setFilter = async (
|
||||
container: HTMLElement,
|
||||
option: DeviceSecurityVariation | string,
|
||||
@@ -749,6 +756,7 @@ describe('<SessionManagerTab />', () => {
|
||||
it('deletes multiple devices', async () => {
|
||||
mockClient.getDevices.mockResolvedValue({ devices: [
|
||||
alicesDevice, alicesMobileDevice, alicesOlderMobileDevice,
|
||||
alicesInactiveDevice,
|
||||
] });
|
||||
mockClient.deleteMultipleDevices.mockResolvedValue({});
|
||||
|
||||
@@ -763,6 +771,24 @@ describe('<SessionManagerTab />', () => {
|
||||
|
||||
fireEvent.click(getByTestId('sign-out-selection-cta'));
|
||||
|
||||
// buttons disabled in list header
|
||||
expect(getByTestId('sign-out-selection-cta').getAttribute('aria-disabled')).toBeTruthy();
|
||||
expect(getByTestId('cancel-selection-cta').getAttribute('aria-disabled')).toBeTruthy();
|
||||
// spinner rendered in list header
|
||||
expect(getByTestId('sign-out-selection-cta').querySelector('.mx_Spinner')).toBeTruthy();
|
||||
|
||||
// spinners on signing out devices
|
||||
expect(getDeviceTile(
|
||||
getByTestId, alicesMobileDevice.device_id,
|
||||
).querySelector('.mx_Spinner')).toBeTruthy();
|
||||
expect(getDeviceTile(
|
||||
getByTestId, alicesOlderMobileDevice.device_id,
|
||||
).querySelector('.mx_Spinner')).toBeTruthy();
|
||||
// no spinner for device that is not signing out
|
||||
expect(getDeviceTile(
|
||||
getByTestId, alicesInactiveDevice.device_id,
|
||||
).querySelector('.mx_Spinner')).toBeFalsy();
|
||||
|
||||
// delete called with both ids
|
||||
expect(mockClient.deleteMultipleDevices).toHaveBeenCalledWith(
|
||||
[
|
||||
|
Reference in New Issue
Block a user