unit test basic paths in UserInfo (#7740)
* unit test main paths in UserInfo component Signed-off-by: Kerry Archibald <kerrya@element.io> * one more test case Signed-off-by: Kerry Archibald <kerrya@element.io> * remove BasicUserInfo export Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
af0b21de9d
commit
30d1ac1eea
5 changed files with 190 additions and 4 deletions
|
@ -69,6 +69,7 @@ const BaseCard: React.FC<IProps> = ({
|
|||
let closeButton;
|
||||
if (onClose) {
|
||||
closeButton = <AccessibleButton
|
||||
data-test-id='base-card-close-button'
|
||||
className="mx_BaseCard_close"
|
||||
onClick={onClose}
|
||||
title={closeLabel || _t("Close")}
|
||||
|
|
|
@ -101,7 +101,7 @@ const EncryptionInfo: React.FC<IProps> = ({
|
|||
}
|
||||
|
||||
return <React.Fragment>
|
||||
<div className="mx_UserInfo_container">
|
||||
<div data-test-id='encryption-info-description' className="mx_UserInfo_container">
|
||||
<h3>{ _t("Encryption") }</h3>
|
||||
{ description }
|
||||
</div>
|
||||
|
|
|
@ -106,6 +106,7 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
|
|||
setPhase(request.phase);
|
||||
}
|
||||
}, [onClose, request]);
|
||||
|
||||
useEventEmitter(request, "change", changeHandler);
|
||||
|
||||
const onStartVerification = useCallback(async () => {
|
||||
|
@ -131,6 +132,7 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
|
|||
const isSelfVerification = request ?
|
||||
request.isSelfVerification :
|
||||
member.userId === MatrixClientPeg.get().getUserId();
|
||||
|
||||
if (!request || requested) {
|
||||
const initiatedByMe = (!request && isRequesting) || (request && request.initiatedByMe);
|
||||
return (
|
||||
|
|
|
@ -1096,6 +1096,7 @@ function useRoomPermissions(cli: MatrixClient, room: Room, user: RoomMember): IR
|
|||
modifyLevelMax,
|
||||
});
|
||||
}, [cli, user, room]);
|
||||
|
||||
useEventEmitter(cli, "RoomState.members", updateRoomPermissions);
|
||||
useEffect(() => {
|
||||
updateRoomPermissions();
|
||||
|
@ -1702,16 +1703,16 @@ const UserInfo: React.FC<IProps> = ({
|
|||
|
||||
let scopeHeader;
|
||||
if (SpaceStore.spacesEnabled && room?.isSpaceRoom()) {
|
||||
scopeHeader = <div className="mx_RightPanel_scopeHeader">
|
||||
scopeHeader = <div data-test-id='space-header' className="mx_RightPanel_scopeHeader">
|
||||
<RoomAvatar room={room} height={32} width={32} />
|
||||
<RoomName room={room} />
|
||||
</div>;
|
||||
}
|
||||
|
||||
const header = <React.Fragment>
|
||||
const header = <>
|
||||
{ scopeHeader }
|
||||
<UserInfoHeader member={member} e2eStatus={e2eStatus} roomId={room?.roomId} />
|
||||
</React.Fragment>;
|
||||
</>;
|
||||
return <BaseCard
|
||||
className={classes.join(" ")}
|
||||
header={header}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue