mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
fix tests
This commit is contained in:
parent
81f1e1d8d7
commit
54e41b5f32
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, {useContext} from 'react';
|
||||
import React, {forwardRef, useContext} from 'react';
|
||||
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
||||
|
||||
import { _t } from '../../../languageHandler';
|
||||
@ -27,7 +27,7 @@ interface IProps {
|
||||
mxEvent: MatrixEvent;
|
||||
}
|
||||
|
||||
const EncryptionEvent: React.FC<IProps> = ({mxEvent}) => {
|
||||
const EncryptionEvent = forwardRef<HTMLDivElement, IProps>(({mxEvent}, ref) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
const roomId = mxEvent.getRoomId();
|
||||
const isRoomEncrypted = MatrixClientPeg.get().isRoomEncrypted(roomId);
|
||||
@ -61,7 +61,8 @@ const EncryptionEvent: React.FC<IProps> = ({mxEvent}) => {
|
||||
className="mx_cryptoEvent mx_cryptoEvent_icon mx_cryptoEvent_icon_warning"
|
||||
title={_t("Encryption not enabled")}
|
||||
subtitle={_t("The encryption used by this room isn't supported.")}
|
||||
ref={ref}
|
||||
/>;
|
||||
}
|
||||
});
|
||||
|
||||
export default EncryptionEvent;
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, {ReactNode} from "react";
|
||||
import React, {forwardRef, ReactNode} from "react";
|
||||
import classNames from "classnames";
|
||||
|
||||
interface IProps {
|
||||
@ -23,12 +23,12 @@ interface IProps {
|
||||
subtitle?: ReactNode;
|
||||
}
|
||||
|
||||
const EventTileBubble: React.FC<IProps> = ({ className, title, subtitle, children }) => {
|
||||
return <div className={classNames("mx_EventTileBubble", className)}>
|
||||
const EventTileBubble = forwardRef<HTMLDivElement, IProps>(({ className, title, subtitle, children }, ref) => {
|
||||
return <div className={classNames("mx_EventTileBubble", className)} ref={ref}>
|
||||
<div className="mx_EventTileBubble_title">{ title }</div>
|
||||
{ subtitle && <div className="mx_EventTileBubble_subtitle">{ subtitle }</div> }
|
||||
{ children }
|
||||
</div>;
|
||||
};
|
||||
});
|
||||
|
||||
export default EventTileBubble;
|
||||
|
@ -29,7 +29,6 @@ const RoomContext = createContext<IState>({
|
||||
guestsCanJoin: false,
|
||||
canPeek: false,
|
||||
showApps: false,
|
||||
isAlone: false,
|
||||
isPeeking: false,
|
||||
showingPinned: false,
|
||||
showReadReceipts: true,
|
||||
|
@ -38,6 +38,7 @@ import { configure, mount } from "enzyme";
|
||||
import Velocity from 'velocity-animate';
|
||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||
import RoomContext from "../../../src/contexts/RoomContext";
|
||||
import DMRoomMap from "../../../src/utils/DMRoomMap";
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
@ -79,6 +80,8 @@ describe('MessagePanel', function() {
|
||||
// complete without this even if we mock the clock and tick it
|
||||
// what should be the correct amount of time).
|
||||
Velocity.mock = true;
|
||||
|
||||
DMRoomMap.makeShared();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
@ -242,6 +242,7 @@ export function mkStubRoom(roomId = null) {
|
||||
setBlacklistUnverifiedDevices: jest.fn(),
|
||||
on: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
getDMInviter: jest.fn(),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user