Device manager - device type and verification icons on device tile (PSG-637) (#9197)
* add unknown device icon * add device type and verification icon component * test * stylelint * fix securitycard spacing Co-authored-by: Travis Ralston <travisr@matrix.org>
This commit is contained in:
parent
5aae974e93
commit
825a0af4a9
18 changed files with 480 additions and 27 deletions
|
@ -111,6 +111,20 @@ exports[`<DevicesPanel /> renders device panel with devices 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-device_1"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -215,6 +229,20 @@ exports[`<DevicesPanel /> renders device panel with devices 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-device_2"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -278,6 +306,20 @@ exports[`<DevicesPanel /> renders device panel with devices 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-device_3"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
|
44
test/components/views/settings/devices/DeviceType-test.tsx
Normal file
44
test/components/views/settings/devices/DeviceType-test.tsx
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { DeviceType } from '../../../../../src/components/views/settings/devices/DeviceType';
|
||||
|
||||
describe('<DeviceType />', () => {
|
||||
const defaultProps = {
|
||||
isVerified: false,
|
||||
isSelected: false,
|
||||
};
|
||||
const getComponent = (props = {}) =>
|
||||
<DeviceType {...defaultProps} {...props} />;
|
||||
|
||||
it('renders an unverified device', () => {
|
||||
const { container } = render(getComponent());
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders a verified device', () => {
|
||||
const { container } = render(getComponent({ isVerified: true }));
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders correctly when selected', () => {
|
||||
const { container } = render(getComponent({ isSelected: true }));
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -141,6 +141,20 @@ exports[`<CurrentDeviceSection /> renders device and correct security card when
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-alices_device"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -227,6 +241,20 @@ exports[`<CurrentDeviceSection /> renders device and correct security card when
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-alices_device"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
|
|
@ -57,8 +57,12 @@ exports[`<DeviceSecurityCard /> renders with children 1`] = `
|
|||
>
|
||||
nice
|
||||
</p>
|
||||
<div>
|
||||
hey
|
||||
<div
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
<div>
|
||||
hey
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,6 +6,20 @@ exports[`<DeviceTile /> renders a device with no metadata 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-123"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -39,6 +53,20 @@ exports[`<DeviceTile /> renders a verified device with no metadata 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-123"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -72,6 +100,20 @@ exports[`<DeviceTile /> renders display name with a tooltip 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-123"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -109,6 +151,20 @@ exports[`<DeviceTile /> separates metadata with a dot 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-123"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<DeviceType /> renders a verified device 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Verified"
|
||||
class="mx_DeviceType_verificationIcon verified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<DeviceType /> renders an unverified device 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<DeviceType /> renders correctly when selected 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="mx_DeviceType mx_DeviceType_selected"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
|
@ -44,11 +44,15 @@ exports[`<SecurityRecommendations /> renders both cards when user has both unver
|
|||
Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore.
|
||||
</p>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
View all (1)
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
View all (1)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -80,11 +84,15 @@ exports[`<SecurityRecommendations /> renders both cards when user has both unver
|
|||
Consider signing out from old sessions (90 days or older) you don't use anymore
|
||||
</p>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
View all (1)
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
View all (1)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -137,11 +145,15 @@ exports[`<SecurityRecommendations /> renders inactive devices section when user
|
|||
Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore.
|
||||
</p>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
View all (1)
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
View all (1)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -173,11 +185,15 @@ exports[`<SecurityRecommendations /> renders inactive devices section when user
|
|||
Consider signing out from old sessions (90 days or older) you don't use anymore
|
||||
</p>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
View all (1)
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
View all (1)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -230,11 +246,15 @@ exports[`<SecurityRecommendations /> renders unverified devices section when use
|
|||
Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore.
|
||||
</p>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
View all (2)
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
View all (2)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -266,11 +286,15 @@ exports[`<SecurityRecommendations /> renders unverified devices section when use
|
|||
Consider signing out from old sessions (90 days or older) you don't use anymore
|
||||
</p>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="mx_DeviceSecurityCard_actions"
|
||||
>
|
||||
View all (1)
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
View all (1)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -36,6 +36,20 @@ exports[`<SelectableDeviceTile /> renders unselected device tile with checkbox 1
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-my-device"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
|
|
@ -17,6 +17,20 @@ exports[`<SessionManagerTab /> renders current session section with a verified s
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-alices_device"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Verified"
|
||||
class="mx_DeviceType_verificationIcon verified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -101,6 +115,20 @@ exports[`<SessionManagerTab /> renders current session section with an unverifie
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-alices_device"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Unverified"
|
||||
class="mx_DeviceType_verificationIcon unverified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
@ -173,6 +201,20 @@ exports[`<SessionManagerTab /> sets device verification status correctly 1`] = `
|
|||
class="mx_DeviceTile"
|
||||
data-testid="device-tile-alices_device"
|
||||
>
|
||||
<div
|
||||
class="mx_DeviceType"
|
||||
>
|
||||
<div
|
||||
aria-label="Unknown device type"
|
||||
class="mx_DeviceType_deviceIcon"
|
||||
role="img"
|
||||
/>
|
||||
<div
|
||||
aria-label="Verified"
|
||||
class="mx_DeviceType_verificationIcon verified"
|
||||
role="img"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx_DeviceTile_info"
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue