device manager - add spinners while devices are signing out (#9433)
This commit is contained in:
parent
72d7939afc
commit
877c95df8f
4 changed files with 42 additions and 3 deletions
|
@ -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(
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue