Upgrade to latest compound-web package (#84)

* Upgrade to latest compound-web package

* Use a custom render function for jest tests

This way we don't need to manually wrap our components with
<TooltipProvider>

* Pin wrap-ansi to fix broken yarn install

* Add playwright helper to find tooltip from element

and use it in the failing test

* Exclude floating-ui divs/spans from axe testing

This is rendered outside .MatrixChat by compound and contains all the
tooltips.

* Wrap outermost components with TooltipProvider

* Remove onChange and use onSelect for toggle

* Fix jest tests and update snapshots

* Use vector-im/matrix-wysiwig

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
R Midhun Suresh 2024-10-14 21:41:58 +05:30 committed by GitHub
parent 3bc0439fd2
commit 91e84f7951
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
389 changed files with 1261 additions and 1084 deletions

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import React from "react";
import { MatrixClient, PendingEventOrdering, Room } from "matrix-js-sdk/src/matrix";
import { render } from "@testing-library/react";
import { render } from "jest-matrix-react";
import { stubClient } from "../../../test-utils";
import AppsDrawer from "../../../../src/components/views/rooms/AppsDrawer";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
import { render, screen } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import { MatrixClient, Room } from "matrix-js-sdk/src/matrix";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { fireEvent, render, screen } from "@testing-library/react";
import { fireEvent, render, screen } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import { Room } from "matrix-js-sdk/src/matrix";
import { ReplacementEvent, RoomMessageEventContent } from "matrix-js-sdk/src/types";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import * as React from "react";
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { act, fireEvent, render, screen, waitFor } from "jest-matrix-react";
import { mocked } from "jest-mock";
import {
EventType,
@ -305,8 +305,8 @@ describe("EventTile", () => {
expect(e2eIcons).toHaveLength(1);
expect(e2eIcons[0].classList).toContain("mx_EventTile_e2eIcon_normal");
fireEvent.focus(e2eIcons[0]);
expect(e2eIcons[0].getAttribute("aria-describedby")).toBeTruthy();
expect(document.getElementById(e2eIcons[0].getAttribute("aria-describedby")!)).toHaveTextContent(
expect(e2eIcons[0].getAttribute("aria-labelledby")).toBeTruthy();
expect(document.getElementById(e2eIcons[0].getAttribute("aria-labelledby")!)).toHaveTextContent(
expectedText,
);
});

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 { getByLabelText, render, RenderResult } from "@testing-library/react";
import { getByLabelText, render, RenderResult } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import React, { ComponentProps } from "react";

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 { getByRole, render } from "@testing-library/react";
import { getByRole, render } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import React, { ComponentProps } from "react";

View file

@ -8,15 +8,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import {
act,
fireEvent,
render,
RenderResult,
screen,
waitFor,
waitForElementToBeRemoved,
} from "@testing-library/react";
import { act, fireEvent, render, RenderResult, screen, waitFor, waitForElementToBeRemoved } from "jest-matrix-react";
import { Room, MatrixClient, RoomState, RoomMember, User, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
import { mocked, MockedObject } from "jest-mock";
@ -409,10 +401,7 @@ describe("MemberList", () => {
await flushPromises();
// button rendered but disabled
expect(screen.getByRole("button", { name: "Invite to this room" })).toHaveAttribute(
"aria-disabled",
"true",
);
expect(screen.getByText("Invite to this room")).toHaveAttribute("aria-disabled", "true");
});
it("renders enabled invite button when current user is a member and has rights to invite", async () => {

View file

@ -7,7 +7,7 @@
*/
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "jest-matrix-react";
import { MatrixClient, RoomMember, Device } from "matrix-js-sdk/src/matrix";
import { UserVerificationStatus, DeviceVerificationStatus } from "matrix-js-sdk/src/crypto-api";
import { mocked } from "jest-mock";
@ -43,9 +43,7 @@ describe("MemberTile", () => {
expect(container).toMatchSnapshot();
await waitFor(async () => {
await userEvent.hover(container.querySelector(".mx_E2EIcon")!);
expect(
screen.getByRole("tooltip", { name: "This user has not verified all of their sessions." }),
).toBeInTheDocument();
expect(screen.getByText("This user has not verified all of their sessions.")).toBeInTheDocument();
});
});
@ -68,9 +66,7 @@ describe("MemberTile", () => {
await waitFor(async () => {
await userEvent.hover(container.querySelector(".mx_E2EIcon")!);
expect(
screen.getByRole("tooltip", {
name: "You have verified this user. This user has verified all of their sessions.",
}),
screen.getByText("You have verified this user. This user has verified all of their sessions."),
).toBeInTheDocument();
});
});

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import * as React from "react";
import { EventType, MatrixEvent, Room, RoomMember, THREAD_RELATION_TYPE } from "matrix-js-sdk/src/matrix";
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { act, fireEvent, render, screen, waitFor } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import {

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "jest-matrix-react";
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
import RoomContext from "../../../../src/contexts/RoomContext";

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
import { render, screen } from "jest-matrix-react";
import { MatrixClient, Room } from "matrix-js-sdk/src/matrix";
import { LocalRoom } from "../../../../src/models/LocalRoom";

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 { fireEvent, render } from "@testing-library/react";
import { fireEvent, render } from "jest-matrix-react";
import React from "react";
import { StatelessNotificationBadge } from "../../../../../src/components/views/rooms/NotificationBadge/StatelessNotificationBadge";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render } from "@testing-library/react";
import { render } from "jest-matrix-react";
import { StatelessNotificationBadge } from "../../../../../src/components/views/rooms/NotificationBadge/StatelessNotificationBadge";
import { NotificationLevel } from "../../../../../src/stores/notifications/NotificationLevel";

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import React from "react";
import "jest-mock";
import { screen, act, render } from "@testing-library/react";
import { screen, act, render } from "jest-matrix-react";
import {
MatrixEvent,
MsgType,

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "jest-matrix-react";
import { EventTimeline, EventType, IEvent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
import userEvent from "@testing-library/user-event";

View file

@ -6,7 +6,7 @@
* Please see LICENSE files in the repository root for full details.
*/
import { act, screen, render } from "@testing-library/react";
import { act, screen, render } from "jest-matrix-react";
import React from "react";
import { EventType, IEvent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
import userEvent from "@testing-library/user-event";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render } from "@testing-library/react";
import { render } from "jest-matrix-react";
import PresenceLabel from "../../../../src/components/views/rooms/PresenceLabel";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React, { ComponentProps } from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "jest-matrix-react";
import { RoomMember } from "matrix-js-sdk/src/matrix";
import userEvent from "@testing-library/user-event";
@ -113,7 +113,8 @@ describe("ReadReceiptGroup", () => {
await userEvent.hover(screen.getByRole("menuitem"));
await waitFor(() => {
const tooltip = screen.getByRole("tooltip", { name: member.rawDisplayName });
const tooltip = screen.getByRole("tooltip");
expect(tooltip.textContent).toMatch(new RegExp(member.rawDisplayName));
expect(tooltip).toMatchSnapshot();
});
});

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
import { render, screen } from "jest-matrix-react";
import ReadReceiptMarker, { IReadReceiptPosition } from "../../../../src/components/views/rooms/ReadReceiptMarker";

View file

@ -30,7 +30,7 @@ import {
RenderOptions,
screen,
waitFor,
} from "@testing-library/react";
} from "jest-matrix-react";
import { ViewRoomOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/RoomViewLifecycle";
import { mocked } from "jest-mock";
@ -150,7 +150,7 @@ describe("RoomHeader", () => {
expect(container).toHaveTextContent("4");
const facePile = getByLabelText(container, "4 members");
const facePile = getByLabelText(document.body, "4 members");
expect(facePile).toHaveTextContent("4");
fireEvent.click(facePile);
@ -166,9 +166,9 @@ describe("RoomHeader", () => {
});
it("opens the thread panel", async () => {
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
fireEvent.click(getByLabelText(container, "Threads"));
fireEvent.click(getByLabelText(document.body, "Threads"));
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.ThreadPanel });
});
@ -177,32 +177,39 @@ describe("RoomHeader", () => {
if (name === "feature_notifications") return true;
});
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
fireEvent.click(getByLabelText(container, "Notifications"));
fireEvent.click(getByLabelText(document.body, "Notifications"));
expect(setCardSpy).toHaveBeenCalledWith({ phase: RightPanelPhases.NotificationPanel });
});
it("should show both call buttons in rooms smaller than 3 members", async () => {
mockRoomMembers(room, 2);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).toBeInTheDocument();
expect(getByLabelText(container, "Voice call")).toBeInTheDocument();
render(<RoomHeader room={room} />, getWrapper());
const voiceButton = screen.getByRole("button", { name: "Voice call" });
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).toBeInTheDocument();
expect(voiceButton).toBeInTheDocument();
});
it("should not show voice call button in managed hybrid environments", async () => {
mockRoomMembers(room, 2);
jest.spyOn(SdkConfig, "get").mockReturnValue({ widget_build_url: "https://widget.build.url" });
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).toBeInTheDocument();
expect(queryByLabelText(container, "Voice call")).not.toBeInTheDocument();
render(<RoomHeader room={room} />, getWrapper());
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Voice call" })).not.toBeInTheDocument();
});
it("should not show voice call button in rooms larger than 2 members", async () => {
mockRoomMembers(room, 3);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).toBeInTheDocument();
expect(queryByLabelText(container, "Voice call")).not.toBeInTheDocument();
render(<RoomHeader room={room} />, getWrapper());
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Voice call" })).not.toBeInTheDocument();
});
describe("UIFeature.Widgets enabled (default)", () => {
@ -212,14 +219,16 @@ describe("RoomHeader", () => {
it("should show call buttons in a room with 2 members", () => {
mockRoomMembers(room, 2);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).toBeInTheDocument();
render(<RoomHeader room={room} />, getWrapper());
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).toBeInTheDocument();
});
it("should show call buttons in a room with more than 2 members", () => {
mockRoomMembers(room, 3);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).toBeInTheDocument();
render(<RoomHeader room={room} />, getWrapper());
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).toBeInTheDocument();
});
});
@ -230,8 +239,10 @@ describe("RoomHeader", () => {
it("should show call buttons in a room with 2 members", () => {
mockRoomMembers(room, 2);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).toBeInTheDocument();
render(<RoomHeader room={room} />, getWrapper());
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).toBeInTheDocument();
});
it("should not show call buttons in a room with more than 2 members", () => {
@ -256,9 +267,10 @@ describe("RoomHeader", () => {
it("you can call when you're two in the room", async () => {
mockRoomMembers(room, 2);
const { container } = render(<RoomHeader room={room} />, getWrapper());
const voiceButton = getByLabelText(container, "Voice call");
const videoButton = getByLabelText(container, "Video call");
render(<RoomHeader room={room} />, getWrapper());
const voiceButton = screen.getByRole("button", { name: "Voice call" });
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(voiceButton).not.toHaveAttribute("aria-disabled", "true");
expect(videoButton).not.toHaveAttribute("aria-disabled", "true");
@ -286,17 +298,20 @@ describe("RoomHeader", () => {
it("can call in large rooms if able to edit widgets", () => {
mockRoomMembers(room, 10);
jest.spyOn(room.currentState, "mayClientSendStateEvent").mockReturnValue(true);
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).not.toHaveAttribute("aria-disabled", "true");
const videoCallButton = screen.getByRole("button", { name: "Video call" });
expect(videoCallButton).not.toHaveAttribute("aria-disabled", "true");
});
it("disable calls in large rooms by default", () => {
mockRoomMembers(room, 10);
jest.spyOn(room.currentState, "mayClientSendStateEvent").mockReturnValue(false);
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
expect(
getByLabelText(container, "You do not have permission to start video calls", { selector: "button" }),
getByLabelText(document.body, "You do not have permission to start video calls", {
selector: "button",
}),
).toHaveAttribute("aria-disabled", "true");
});
});
@ -314,17 +329,16 @@ describe("RoomHeader", () => {
// allow element calls
jest.spyOn(room.currentState, "mayClientSendStateEvent").mockReturnValue(true);
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
expect(screen.queryByTitle("Voice call")).toBeNull();
const videoCallButton = getByLabelText(container, "Video call");
const videoCallButton = screen.getByRole("button", { name: "Video call" });
expect(videoCallButton).not.toHaveAttribute("aria-disabled", "true");
const dispatcherSpy = jest.spyOn(dispatcher, "dispatch");
fireEvent.click(getByLabelText(container, "Video call"));
fireEvent.click(videoCallButton);
expect(dispatcherSpy).toHaveBeenCalledWith(expect.objectContaining({ view_call: true }));
});
@ -340,8 +354,8 @@ describe("RoomHeader", () => {
off: () => {},
} as unknown as Call);
jest.spyOn(WidgetStore.instance, "getApps").mockReturnValue([widget]);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Ongoing call")).toHaveAttribute("aria-disabled", "true");
render(<RoomHeader room={room} />, getWrapper());
expect(screen.getByRole("button", { name: "Ongoing call" })).toHaveAttribute("aria-disabled", "true");
});
it("clicking on ongoing (unpinned) call re-pins it", () => {
@ -360,9 +374,11 @@ describe("RoomHeader", () => {
} as unknown as Call);
jest.spyOn(WidgetStore.instance, "getApps").mockReturnValue([widget]);
const { container } = render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Video call")).not.toHaveAttribute("aria-disabled", "true");
fireEvent.click(getByLabelText(container, "Video call"));
render(<RoomHeader room={room} />, getWrapper());
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).not.toHaveAttribute("aria-disabled", "true");
fireEvent.click(videoButton);
expect(spy).toHaveBeenCalledWith(room, widget, Container.Top);
});
@ -444,10 +460,10 @@ describe("RoomHeader", () => {
if (key === "im.vector.modular.widgets") return true;
return false;
});
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
const voiceButton = getByLabelText(container, "Voice call");
const videoButton = getByLabelText(container, "Video call");
const voiceButton = screen.getByRole("button", { name: "Voice call" });
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(voiceButton).not.toHaveAttribute("aria-disabled", "true");
expect(videoButton).not.toHaveAttribute("aria-disabled", "true");
@ -467,9 +483,9 @@ describe("RoomHeader", () => {
return false;
});
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
const videoButton = getByLabelText(container, "Video call");
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).not.toHaveAttribute("aria-disabled", "true");
const placeCallSpy = jest.spyOn(LegacyCallHandler.instance, "placeCall");
@ -485,9 +501,9 @@ describe("RoomHeader", () => {
return false;
});
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
const videoButton = getByLabelText(container, "Video call");
const videoButton = screen.getByRole("button", { name: "Video call" });
expect(videoButton).not.toHaveAttribute("aria-disabled", "true");
const dispatcherSpy = jest.spyOn(dispatcher, "dispatch");
@ -511,8 +527,8 @@ describe("RoomHeader", () => {
it("join button is shown if there is an ongoing call", async () => {
mockRoomMembers(room, 3);
jest.spyOn(UseCall, "useParticipantCount").mockReturnValue(3);
const { container } = render(<RoomHeader room={room} />, getWrapper());
const joinButton = getByLabelText(container, "Join");
render(<RoomHeader room={room} />, getWrapper());
const joinButton = getByLabelText(document.body, "Join");
expect(joinButton).not.toHaveAttribute("aria-disabled", "true");
});
@ -522,8 +538,8 @@ describe("RoomHeader", () => {
jest.spyOn(CallStore.prototype, "connectedCalls", "get").mockReturnValue(
new Set([{ roomId: "some_other_room" } as Call]),
);
const { container } = render(<RoomHeader room={room} />, getWrapper());
const joinButton = getByLabelText(container, "Ongoing call");
render(<RoomHeader room={room} />, getWrapper());
const joinButton = getByLabelText(document.body, "Ongoing call");
expect(joinButton).toHaveAttribute("aria-disabled", "true");
});
@ -532,8 +548,8 @@ describe("RoomHeader", () => {
mockRoomMembers(room, 3);
jest.spyOn(SdkContextClass.instance.roomViewStore, "isViewingCall").mockReturnValue(true);
const { container } = render(<RoomHeader room={room} />, getWrapper());
getByLabelText(container, "Close lobby");
render(<RoomHeader room={room} />, getWrapper());
getByLabelText(document.body, "Close lobby");
});
it("close lobby button is shown if there is an ongoing call but we are viewing the lobby", async () => {
@ -541,8 +557,8 @@ describe("RoomHeader", () => {
jest.spyOn(UseCall, "useParticipantCount").mockReturnValue(3);
jest.spyOn(SdkContextClass.instance.roomViewStore, "isViewingCall").mockReturnValue(true);
const { container } = render(<RoomHeader room={room} />, getWrapper());
getByLabelText(container, "Close lobby");
render(<RoomHeader room={room} />, getWrapper());
getByLabelText(document.body, "Close lobby");
});
it("don't show external conference button if the call is not shown", () => {
@ -550,14 +566,14 @@ describe("RoomHeader", () => {
jest.spyOn(SdkConfig, "get").mockImplementation((key) => {
return { guest_spa_url: "https://guest_spa_url.com", url: "https://spa_url.com" };
});
let { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
expect(screen.queryByLabelText(_t("voip|get_call_link"))).not.toBeInTheDocument();
jest.spyOn(SdkContextClass.instance.roomViewStore, "isViewingCall").mockReturnValue(true);
container = render(<RoomHeader room={room} />, getWrapper()).container;
render(<RoomHeader room={room} />, getWrapper()).container;
expect(getByLabelText(container, _t("voip|get_call_link"))).toBeInTheDocument();
expect(getByLabelText(document.body, _t("voip|get_call_link"))).toBeInTheDocument();
});
});
@ -572,9 +588,9 @@ describe("RoomHeader", () => {
});
room.addLiveEvents([joinRuleEvent]);
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
expect(getByLabelText(container, "Public room")).toBeInTheDocument();
expect(getByLabelText(document.body, "Public room")).toBeInTheDocument();
});
});
@ -618,9 +634,9 @@ describe("RoomHeader", () => {
])("shows the %s icon", async (value: ShieldUtils.E2EStatus, expectedLabel: string) => {
jest.spyOn(ShieldUtils, "shieldStatusForRoom").mockResolvedValue(value);
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
await waitFor(() => expect(getByLabelText(container, expectedLabel)).toBeInTheDocument());
await waitFor(() => expect(getByLabelText(document.body, expectedLabel)).toBeInTheDocument());
});
it("does not show the face pile for DMs", () => {
@ -685,10 +701,10 @@ describe("RoomHeader", () => {
});
it("should open room settings when clicking the room avatar", async () => {
const { container } = render(<RoomHeader room={room} />, getWrapper());
render(<RoomHeader room={room} />, getWrapper());
const dispatcherSpy = jest.spyOn(dispatcher, "dispatch");
fireEvent.click(getByLabelText(container, "Open room settings"));
fireEvent.click(getByLabelText(document.body, "Open room settings"));
expect(dispatcherSpy).toHaveBeenCalledWith(expect.objectContaining({ action: "open_room_settings" }));
});
});

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { fireEvent, getByLabelText, getByText, render, screen, waitFor } from "@testing-library/react";
import { fireEvent, getByLabelText, getByText, render, screen, waitFor } from "jest-matrix-react";
import { EventTimeline, JoinRule, Room } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
@ -99,7 +99,7 @@ describe("<CallGuestLinkButton />", () => {
it("shows the JoinRuleDialog on click with private join rules", async () => {
getComponent(room);
fireEvent.click(screen.getByLabelText("Share call link"));
fireEvent.click(screen.getByRole("button", { name: "Share call link" }));
expect(modalSpy).toHaveBeenCalledWith(JoinRuleDialog, { room, canInvite: false });
// pretend public was selected
jest.spyOn(room, "getJoinRule").mockReturnValue(JoinRule.Public);
@ -115,7 +115,7 @@ describe("<CallGuestLinkButton />", () => {
it("shows the ShareDialog on click with public join rules", () => {
jest.spyOn(room, "getJoinRule").mockReturnValue(JoinRule.Public);
getComponent(room);
fireEvent.click(screen.getByLabelText("Share call link"));
fireEvent.click(screen.getByRole("button", { name: "Share call link" }));
const callParams = modalSpy.mock.calls[0];
expect(callParams[0]).toEqual(ShareDialog);
expect(callParams[1].target.toString()).toEqual(expectedShareDialogProps.target);
@ -127,7 +127,7 @@ describe("<CallGuestLinkButton />", () => {
jest.spyOn(room, "getJoinRule").mockReturnValue(JoinRule.Knock);
jest.spyOn(room, "canInvite").mockReturnValue(true);
getComponent(room);
fireEvent.click(screen.getByLabelText("Share call link"));
fireEvent.click(screen.getByRole("button", { name: "Share call link" }));
const callParams = modalSpy.mock.calls[0];
expect(callParams[0]).toEqual(ShareDialog);
expect(callParams[1].target.toString()).toEqual(expectedShareDialogProps.target);
@ -170,17 +170,17 @@ describe("<CallGuestLinkButton />", () => {
return oldGet(key);
});
const { container } = getComponent(room);
expect(getByLabelText(container, "Share call link")).toBeInTheDocument();
getComponent(room);
expect(getByLabelText(document.body, "Share call link")).toBeInTheDocument();
});
it("opens the share dialog with the correct share link in an encrypted room", () => {
jest.spyOn(room, "getJoinRule").mockReturnValue(JoinRule.Public);
jest.spyOn(SdkContextClass.instance.roomViewStore, "isViewingCall").mockReturnValue(true);
const { container } = getComponent(room);
getComponent(room);
const modalSpy = jest.spyOn(Modal, "createDialog");
fireEvent.click(getByLabelText(container, _t("voip|get_call_link")));
fireEvent.click(getByLabelText(document.body, _t("voip|get_call_link")));
// const target =
// "https://guest_spa_url.com/room/#/!room:server.org?roomId=%21room%3Aserver.org&perParticipantE2EE=true&viaServers=example.org";
expect(modalSpy).toHaveBeenCalled();
@ -200,9 +200,9 @@ describe("<CallGuestLinkButton />", () => {
jest.spyOn(room, "hasEncryptionStateEvent").mockReturnValue(false);
jest.spyOn(SdkContextClass.instance.roomViewStore, "isViewingCall").mockReturnValue(true);
const { container } = getComponent(room);
getComponent(room);
const modalSpy = jest.spyOn(Modal, "createDialog");
fireEvent.click(getByLabelText(container, _t("voip|get_call_link")));
fireEvent.click(getByLabelText(document.body, _t("voip|get_call_link")));
const arg1 = modalSpy.mock.calls[0][1] as any;
expect(arg1.target.toString()).toEqual(targetUnencrypted);
});

View file

@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
import React from "react";
import { MockedObject } from "jest-mock";
import { Room } from "matrix-js-sdk/src/matrix";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { fireEvent, render, screen, waitFor } from "jest-matrix-react";
import { VideoRoomChatButton } from "../../../../../src/components/views/rooms/RoomHeader/VideoRoomChatButton";
import { SDKContext, SdkContextClass } from "../../../../../src/contexts/SDKContext";
@ -71,7 +71,7 @@ describe("<VideoRoomChatButton />", () => {
const room = makeRoom();
getComponent(room);
fireEvent.click(screen.getByLabelText("Chat"));
fireEvent.click(screen.getByRole("button", { name: "Chat" }));
expect(sdkContext.rightPanelStore.showOrHidePhase).toHaveBeenCalledWith(RightPanelPhases.Timeline);
});
@ -82,8 +82,8 @@ describe("<VideoRoomChatButton />", () => {
getComponent(room);
// snapshot includes `data-indicator` attribute
expect(screen.getByLabelText("Chat")).toMatchSnapshot();
expect(screen.getByLabelText("Chat").hasAttribute("data-indicator")).toBeTruthy();
expect(screen.getByRole("button", { name: "Chat" })).toMatchSnapshot();
expect(screen.getByRole("button", { name: "Chat" }).hasAttribute("data-indicator")).toBeTruthy();
});
it("adds unread marker when room notification state changes to unread", async () => {
@ -93,14 +93,16 @@ describe("<VideoRoomChatButton />", () => {
getComponent(room);
// no unread marker
expect(screen.getByLabelText("Chat").hasAttribute("data-indicator")).toBeFalsy();
expect(screen.getByRole("button", { name: "Chat" }).hasAttribute("data-indicator")).toBeFalsy();
// @ts-ignore ugly mocking
notificationState._level = NotificationLevel.Highlight;
notificationState.emit(NotificationStateEvents.Update);
// unread marker
await waitFor(() => expect(screen.getByLabelText("Chat").hasAttribute("data-indicator")).toBeTruthy());
await waitFor(() =>
expect(screen.getByRole("button", { name: "Chat" }).hasAttribute("data-indicator")).toBeTruthy(),
);
});
it("clears unread marker when room notification state changes to read", async () => {
@ -110,13 +112,15 @@ describe("<VideoRoomChatButton />", () => {
getComponent(room);
// unread marker
expect(screen.getByLabelText("Chat").hasAttribute("data-indicator")).toBeTruthy();
expect(screen.getByRole("button", { name: "Chat" }).hasAttribute("data-indicator")).toBeTruthy();
// @ts-ignore ugly mocking
notificationState._level = NotificationLevel.None;
notificationState.emit(NotificationStateEvents.Update);
// unread marker cleared
await waitFor(() => expect(screen.getByLabelText("Chat").hasAttribute("data-indicator")).toBeFalsy());
await waitFor(() =>
expect(screen.getByRole("button", { name: "Chat" }).hasAttribute("data-indicator")).toBeFalsy(),
);
});
});

View file

@ -3,6 +3,7 @@
exports[`<VideoRoomChatButton /> renders button with an unread marker when room is unread 1`] = `
<button
aria-label="Chat"
aria-labelledby="floating-ui-6"
class="_icon-button_bh2qc_17"
data-indicator="default"
role="button"

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 { act, fireEvent, render, screen } from "@testing-library/react";
import { act, fireEvent, render, screen } from "jest-matrix-react";
import {
EventTimeline,
EventType,

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { cleanup, queryByRole, render, screen, within } from "@testing-library/react";
import { cleanup, queryByRole, render, screen, within } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import { mocked } from "jest-mock";
import { Room } from "matrix-js-sdk/src/matrix";

View file

@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
import React from "react";
import { MatrixClient, Room, EventType } from "matrix-js-sdk/src/matrix";
import { mocked } from "jest-mock";
import { act, render, screen, fireEvent, RenderResult } from "@testing-library/react";
import { act, render, screen, fireEvent, RenderResult } from "jest-matrix-react";
import SpaceStore from "../../../../src/stores/spaces/SpaceStore";
import { MetaSpace } from "../../../../src/stores/spaces";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React, { ComponentProps } from "react";
import { render, fireEvent, RenderResult, waitFor, waitForElementToBeRemoved } from "@testing-library/react";
import { render, fireEvent, RenderResult, waitFor, waitForElementToBeRemoved } from "jest-matrix-react";
import { Room, RoomMember, MatrixError, IContent } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import React from "react";
import { mocked, Mocked } from "jest-mock";
import { render, screen, act } from "@testing-library/react";
import { render, screen, act } from "jest-matrix-react";
import { PendingEventOrdering, Room, RoomStateEvent, RoomType } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
import { render, screen } from "jest-matrix-react";
import RoomSearchAuxPanel from "../../../../src/components/views/rooms/RoomSearchAuxPanel";
import { SearchScope } from "../../../../src/Searching";
@ -81,7 +81,7 @@ describe("RoomSearchAuxPanel", () => {
/>,
);
screen.getByLabelText("Cancel").click();
screen.getByRole("button", { name: "Cancel" }).click();
expect(onCancelClick).toHaveBeenCalled();
});
});

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen, act, RenderResult } from "@testing-library/react";
import { render, screen, act, RenderResult } from "jest-matrix-react";
import { mocked, Mocked } from "jest-mock";
import {
MatrixClient,

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import * as React from "react";
import { MatrixEvent, Room, EventType } from "matrix-js-sdk/src/matrix";
import { render, type RenderResult } from "@testing-library/react";
import { render, type RenderResult } from "jest-matrix-react";
import { stubClient } from "../../../test-utils";
import SearchResultTile from "../../../../src/components/views/rooms/SearchResultTile";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { fireEvent, render, waitFor } from "@testing-library/react";
import { fireEvent, render, waitFor } from "jest-matrix-react";
import { IContent, MatrixClient, MsgType } from "matrix-js-sdk/src/matrix";
import { mocked } from "jest-mock";
import userEvent from "@testing-library/user-event";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
import { render, screen } from "jest-matrix-react";
import { EventType, IEvent, MatrixEvent, Room, RoomMember } from "matrix-js-sdk/src/matrix";
import ThirdPartyMemberInfo from "../../../../src/components/views/rooms/ThirdPartyMemberInfo";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React, { createRef, RefObject } from "react";
import { render } from "@testing-library/react";
import { render } from "jest-matrix-react";
import { MatrixClient, MsgType, Room } from "matrix-js-sdk/src/matrix";
import { mocked } from "jest-mock";

View file

@ -25,6 +25,7 @@ exports[`<PinnedEventTile /> should render pinned event 1`] = `
class="mx_PinnedEventTile_top"
>
<span
aria-labelledby="floating-ui-1"
class="mx_PinnedEventTile_sender mx_Username_color2"
>
@alice:server.org
@ -100,6 +101,7 @@ exports[`<PinnedEventTile /> should render pinned event with thread info 1`] = `
class="mx_PinnedEventTile_top"
>
<span
aria-labelledby="floating-ui-6"
class="mx_PinnedEventTile_sender mx_Username_color2"
>
@alice:server.org
@ -194,7 +196,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
tabindex="-1"
>
<button
class="_item_1gwvj_17 _interactive_1gwvj_36"
class="_item_8j2l6_17 _interactive_8j2l6_35"
data-kind="primary"
data-orientation="vertical"
data-radix-collection-item=""
@ -203,7 +205,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
>
<svg
aria-hidden="true"
class="_icon_1gwvj_44"
class="_icon_8j2l6_43"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
@ -215,13 +217,13 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
/>
</svg>
<span
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_1gwvj_53"
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_8j2l6_52"
>
View in timeline
</span>
<svg
aria-hidden="true"
class="_nav-hint_1gwvj_60"
class="_nav-hint_8j2l6_59"
fill="currentColor"
height="24"
viewBox="8 0 8 24"
@ -234,7 +236,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
</svg>
</button>
<button
class="_item_1gwvj_17 _interactive_1gwvj_36"
class="_item_8j2l6_17 _interactive_8j2l6_35"
data-kind="primary"
data-orientation="vertical"
data-radix-collection-item=""
@ -243,7 +245,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
>
<svg
aria-hidden="true"
class="_icon_1gwvj_44"
class="_icon_8j2l6_43"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
@ -260,13 +262,13 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
/>
</svg>
<span
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_1gwvj_53"
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_8j2l6_52"
>
Unpin
</span>
<svg
aria-hidden="true"
class="_nav-hint_1gwvj_60"
class="_nav-hint_8j2l6_59"
fill="currentColor"
height="24"
viewBox="8 0 8 24"
@ -279,7 +281,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
</svg>
</button>
<button
class="_item_1gwvj_17 _interactive_1gwvj_36"
class="_item_8j2l6_17 _interactive_8j2l6_35"
data-kind="primary"
data-orientation="vertical"
data-radix-collection-item=""
@ -288,7 +290,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
>
<svg
aria-hidden="true"
class="_icon_1gwvj_44"
class="_icon_8j2l6_43"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
@ -300,13 +302,13 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
/>
</svg>
<span
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_1gwvj_53"
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_8j2l6_52"
>
Forward
</span>
<svg
aria-hidden="true"
class="_nav-hint_1gwvj_60"
class="_nav-hint_8j2l6_59"
fill="currentColor"
height="24"
viewBox="8 0 8 24"
@ -325,7 +327,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
role="separator"
/>
<button
class="_item_1gwvj_17 _interactive_1gwvj_36"
class="_item_8j2l6_17 _interactive_8j2l6_35"
data-kind="critical"
data-orientation="vertical"
data-radix-collection-item=""
@ -334,7 +336,7 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
>
<svg
aria-hidden="true"
class="_icon_1gwvj_44"
class="_icon_8j2l6_43"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
@ -346,13 +348,13 @@ exports[`<PinnedEventTile /> should render the menu with all the options 1`] = `
/>
</svg>
<span
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_1gwvj_53"
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_8j2l6_52"
>
Delete
</span>
<svg
aria-hidden="true"
class="_nav-hint_1gwvj_60"
class="_nav-hint_8j2l6_59"
fill="currentColor"
height="24"
viewBox="8 0 8 24"
@ -385,7 +387,7 @@ exports[`<PinnedEventTile /> should render the menu without unpin and delete 1`]
tabindex="-1"
>
<button
class="_item_1gwvj_17 _interactive_1gwvj_36"
class="_item_8j2l6_17 _interactive_8j2l6_35"
data-kind="primary"
data-orientation="vertical"
data-radix-collection-item=""
@ -394,7 +396,7 @@ exports[`<PinnedEventTile /> should render the menu without unpin and delete 1`]
>
<svg
aria-hidden="true"
class="_icon_1gwvj_44"
class="_icon_8j2l6_43"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
@ -406,13 +408,13 @@ exports[`<PinnedEventTile /> should render the menu without unpin and delete 1`]
/>
</svg>
<span
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_1gwvj_53"
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_8j2l6_52"
>
View in timeline
</span>
<svg
aria-hidden="true"
class="_nav-hint_1gwvj_60"
class="_nav-hint_8j2l6_59"
fill="currentColor"
height="24"
viewBox="8 0 8 24"
@ -425,7 +427,7 @@ exports[`<PinnedEventTile /> should render the menu without unpin and delete 1`]
</svg>
</button>
<button
class="_item_1gwvj_17 _interactive_1gwvj_36"
class="_item_8j2l6_17 _interactive_8j2l6_35"
data-kind="primary"
data-orientation="vertical"
data-radix-collection-item=""
@ -434,7 +436,7 @@ exports[`<PinnedEventTile /> should render the menu without unpin and delete 1`]
>
<svg
aria-hidden="true"
class="_icon_1gwvj_44"
class="_icon_8j2l6_43"
fill="currentColor"
height="24"
viewBox="0 0 24 24"
@ -446,13 +448,13 @@ exports[`<PinnedEventTile /> should render the menu without unpin and delete 1`]
/>
</svg>
<span
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_1gwvj_53"
class="_typography_yh5dq_162 _font-body-md-medium_yh5dq_69 _label_8j2l6_52"
>
Forward
</span>
<svg
aria-hidden="true"
class="_nav-hint_1gwvj_60"
class="_nav-hint_8j2l6_59"
fill="currentColor"
height="24"
viewBox="8 0 8 24"

View file

@ -121,7 +121,7 @@ exports[`<PinnedMessageBanner /> should display the last message when the pinned
</div>
</button>
<button
class="_button_zt6rp_17 mx_PinnedMessageBanner_actions"
class="_button_i91xf_17 mx_PinnedMessageBanner_actions"
data-kind="tertiary"
data-size="lg"
role="button"
@ -415,7 +415,7 @@ exports[`<PinnedMessageBanner /> should render 2 pinned event 1`] = `
</div>
</button>
<button
class="_button_zt6rp_17 mx_PinnedMessageBanner_actions"
class="_button_i91xf_17 mx_PinnedMessageBanner_actions"
data-kind="tertiary"
data-size="lg"
role="button"
@ -493,7 +493,7 @@ exports[`<PinnedMessageBanner /> should render 4 pinned event 1`] = `
</div>
</button>
<button
class="_button_zt6rp_17 mx_PinnedMessageBanner_actions"
class="_button_i91xf_17 mx_PinnedMessageBanner_actions"
data-kind="tertiary"
data-size="lg"
role="button"

View file

@ -2,9 +2,7 @@
exports[`ReadReceiptGroup <ReadReceiptPerson /> should display a tooltip 1`] = `
<div
aria-describedby="floating-ui-5"
aria-labelledby="floating-ui-4"
class="_tooltip_svz44_17"
class="_tooltip_1pslb_17"
id="floating-ui-6"
role="tooltip"
style="position: absolute; left: 0px; top: 0px; transform: translate(0px, 0px);"
@ -12,7 +10,7 @@ exports[`ReadReceiptGroup <ReadReceiptPerson /> should display a tooltip 1`] = `
>
<svg
aria-hidden="true"
class="_arrow_svz44_34"
class="_arrow_1pslb_42"
height="10"
style="position: absolute; pointer-events: none; top: 100%;"
viewBox="0 0 10 10"
@ -39,7 +37,7 @@ exports[`ReadReceiptGroup <ReadReceiptPerson /> should display a tooltip 1`] = `
Alice
</span>
<span
class="_caption_svz44_29 cpd-theme-dark"
class="_caption_1pslb_37 cpd-theme-dark"
id="floating-ui-5"
>
@alice:example.org

View file

@ -47,7 +47,7 @@ exports[`RoomHeader dm does not show the face pile for DMs 1`] = `
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-2x);"
>
<button
aria-label="Close lobby"
aria-labelledby="floating-ui-1180"
class="_icon-button_bh2qc_17"
role="button"
style="--cpd-icon-button-size: 32px;"
@ -73,6 +73,7 @@ exports[`RoomHeader dm does not show the face pile for DMs 1`] = `
<button
aria-disabled="true"
aria-label="There's no one here to call"
aria-labelledby="floating-ui-1185"
class="_icon-button_bh2qc_17"
role="button"
style="--cpd-icon-button-size: 32px;"
@ -97,6 +98,7 @@ exports[`RoomHeader dm does not show the face pile for DMs 1`] = `
</button>
<button
aria-label="Room info"
aria-labelledby="floating-ui-1190"
class="_icon-button_bh2qc_17"
role="button"
style="--cpd-icon-button-size: 32px;"
@ -121,6 +123,7 @@ exports[`RoomHeader dm does not show the face pile for DMs 1`] = `
</button>
<button
aria-label="Threads"
aria-labelledby="floating-ui-1195"
class="_icon-button_bh2qc_17"
role="button"
style="--cpd-icon-button-size: 32px;"

View file

@ -19,6 +19,7 @@ exports[`<ThirdPartyMemberInfo /> should render invite 1`] = `
</p>
</div>
<button
aria-labelledby="floating-ui-1"
class="_icon-button_bh2qc_17 _subtle-bg_bh2qc_38"
data-testid="base-card-close-button"
role="button"
@ -92,6 +93,7 @@ exports[`<ThirdPartyMemberInfo /> should render invite when room in not availabl
</p>
</div>
<button
aria-labelledby="floating-ui-6"
class="_icon-button_bh2qc_17 _subtle-bg_bh2qc_38"
data-testid="base-card-close-button"
role="button"

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import "@testing-library/jest-dom";
import React from "react";
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { act, fireEvent, render, screen, waitFor } from "jest-matrix-react";
import MatrixClientContext from "../../../../../src/contexts/MatrixClientContext";
import RoomContext from "../../../../../src/contexts/RoomContext";

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import "@testing-library/jest-dom";
import React from "react";
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { act, fireEvent, render, screen, waitFor } from "jest-matrix-react";
import MatrixClientContext from "../../../../../src/contexts/MatrixClientContext";
import RoomContext from "../../../../../src/contexts/RoomContext";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { cleanup, render, screen, waitFor } from "@testing-library/react";
import { cleanup, render, screen, waitFor } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import { ActionState, ActionTypes, AllActionStates, FormattingFunctions } from "@vector-im/matrix-wysiwyg";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import { FormattingFunctions } from "@vector-im/matrix-wysiwyg";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "jest-matrix-react";
import React from "react";
import userEvent from "@testing-library/user-event";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { act, render, screen } from "@testing-library/react";
import { act, render, screen } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import { PlainTextComposer } from "../../../../../../src/components/views/rooms/wysiwyg_composer/components/PlainTextComposer";

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import "@testing-library/jest-dom";
import React, { createRef } from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "jest-matrix-react";
import MatrixClientContext from "../../../../../../src/contexts/MatrixClientContext";
import RoomContext from "../../../../../../src/contexts/RoomContext";

View file

@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
import "@testing-library/jest-dom";
import React from "react";
import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { act, fireEvent, render, screen, waitFor } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
import { WysiwygComposer } from "../../../../../../src/components/views/rooms/wysiwyg_composer/components/WysiwygComposer";

View file

@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import { renderHook } from "@testing-library/react-hooks";
import { act } from "@testing-library/react";
import { act } from "jest-matrix-react";
import { usePlainTextListeners } from "../../../../../../src/components/views/rooms/wysiwyg_composer/hooks/usePlainTextListeners";

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 { IEventRelation, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { waitFor } from "@testing-library/react";
import { waitFor } from "jest-matrix-react";
import { TimelineRenderingType } from "../../../../../../src/contexts/RoomContext";
import { mkStubRoom, stubClient } from "../../../../../test-utils";