Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2024-12-06 11:41:40 +00:00
parent 62c765bfd3
commit 4f14d3f5ae
39 changed files with 182 additions and 199 deletions

View File

@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
*/
import React, { ReactElement } from "react";
import React, { DOMAttributes, ReactElement } from "react";
import { mocked } from "jest-mock";
import { render, screen } from "jest-matrix-react";
import { IContent } from "matrix-js-sdk/src/matrix";
@@ -57,8 +57,9 @@ describe("topicToHtml", () => {
});
describe("bodyToHtml", () => {
function getHtml(content: IContent, highlights?: string[]): string {
return (bodyToSpan(content, highlights, {}) as ReactElement).props.dangerouslySetInnerHTML.__html;
function getHtml(content: IContent, highlights?: string[]): string | TrustedHTML | undefined {
return ((bodyToSpan(content, highlights, {}) as ReactElement).props as DOMAttributes<any>)
.dangerouslySetInnerHTML?.__html;
}
it("should apply highlights to HTML messages", () => {

View File

@@ -118,7 +118,7 @@ describe("RoomView", () => {
cleanup();
});
const mountRoomView = async (ref?: RefObject<RoomView>): Promise<RenderResult> => {
const mountRoomView = async (ref?: RefObject<RoomView | null>): Promise<RenderResult> => {
if (stores.roomViewStore.getRoomId() !== room.roomId) {
const switchedRoom = new Promise<void>((resolve) => {
const subFn = () => {

View File

@@ -18,7 +18,7 @@ describe("SeekBar", () => {
let playback: Playback;
let renderResult: RenderResult;
let frameRequestCallback: FrameRequestCallback;
let seekBarRef: RefObject<SeekBar>;
let seekBarRef: RefObject<SeekBar | null>;
beforeEach(() => {
seekBarRef = createRef();

View File

@@ -34,7 +34,7 @@ jest.mock("../../../../../src/stores/VoiceRecordingStore", () => ({
}));
describe("<VoiceRecordComposerTile/>", () => {
let voiceRecordComposerTile: RefObject<VoiceRecordComposerTile>;
let voiceRecordComposerTile: RefObject<VoiceRecordComposerTile | null>;
let mockRecorder: VoiceMessageRecording;
let mockUpload: IUpload;
let mockClient: MatrixClient;

View File

@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import React, { type JSX } from "react";
import { TranslationStringsObject } from "@matrix-org/react-sdk-module-api/lib/types/translations";
import { AccountAuthInfo } from "@matrix-org/react-sdk-module-api/lib/types/AccountAuthInfo";
import { DialogContent, DialogProps } from "@matrix-org/react-sdk-module-api/lib/components/DialogContent";
@@ -236,7 +236,7 @@ describe("ProxiedApiModule", () => {
super(props);
}
trySubmit = async () => ({ result: true });
render = () => (
render = (): JSX.Element => (
<button type="button" onClick={this.props.cancel}>
No need for action
</button>