Fix React contexts (#12855)
This commit is contained in:
parent
9b77279b3e
commit
b6addb4118
35 changed files with 99 additions and 107 deletions
|
@ -535,7 +535,7 @@ function createRightClickMenu(mxEvent: MatrixEvent, context?: Partial<IRoomState
|
|||
|
||||
function createMenuWithContent(
|
||||
eventContent: object,
|
||||
props?: Partial<React.ComponentProps<typeof MessageContextMenu>>,
|
||||
props?: Partial<MessageContextMenu["props"]>,
|
||||
context?: Partial<IRoomState>,
|
||||
): RenderResult {
|
||||
// XXX: We probably shouldn't be assuming all events are going to be message events, but considering this
|
||||
|
@ -552,7 +552,7 @@ function makeDefaultRoom(): Room {
|
|||
|
||||
function createMenu(
|
||||
mxEvent: MatrixEvent,
|
||||
props?: Partial<React.ComponentProps<typeof MessageContextMenu>>,
|
||||
props?: Partial<MessageContextMenu["props"]>,
|
||||
context: Partial<IRoomState> = {},
|
||||
beacons: Map<BeaconIdentifier, Beacon> = new Map(),
|
||||
room: Room = makeDefaultRoom(),
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { ComponentProps } from "react";
|
||||
import React from "react";
|
||||
import { fireEvent, render, waitFor } from "@testing-library/react";
|
||||
import { LocationAssetType, ClientEvent, RoomMember, SyncState } from "matrix-js-sdk/src/matrix";
|
||||
import * as maplibregl from "maplibre-gl";
|
||||
|
@ -42,7 +42,7 @@ describe("MLocationBody", () => {
|
|||
isGuest: jest.fn().mockReturnValue(false),
|
||||
});
|
||||
const defaultEvent = makeLocationEvent("geo:51.5076,-0.1276", LocationAssetType.Pin);
|
||||
const defaultProps: ComponentProps<typeof MLocationBody> = {
|
||||
const defaultProps: MLocationBody["props"] = {
|
||||
mxEvent: defaultEvent,
|
||||
highlights: [],
|
||||
highlightLink: "",
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { ComponentProps } from "react";
|
||||
import React from "react";
|
||||
import { EventType, getHttpUriForMxc, IContent, MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { render, RenderResult } from "@testing-library/react";
|
||||
import fetchMock from "fetch-mock-jest";
|
||||
|
@ -117,7 +117,7 @@ function makeMVideoBody(w: number, h: number): RenderResult {
|
|||
content,
|
||||
});
|
||||
|
||||
const defaultProps: ComponentProps<typeof MVideoBody> = {
|
||||
const defaultProps: MVideoBody["props"] = {
|
||||
mxEvent: event,
|
||||
highlights: [],
|
||||
highlightLink: "",
|
||||
|
|
|
@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { ComponentProps } from "react";
|
||||
import React from "react";
|
||||
import { cleanup, queryByRole, render, screen, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { mocked } from "jest-mock";
|
||||
|
@ -53,7 +53,7 @@ describe("RoomList", () => {
|
|||
const client = MatrixClientPeg.safeGet();
|
||||
const store = SpaceStore.instance;
|
||||
|
||||
function getComponent(props: Partial<ComponentProps<typeof RoomList>> = {}): JSX.Element {
|
||||
function getComponent(props: Partial<RoomList["props"]> = {}): JSX.Element {
|
||||
return (
|
||||
<RoomList
|
||||
onKeyDown={jest.fn()}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue