Merge remote-tracking branch 'origin/livekit' into hs/reactions-viewcallmodel

This commit is contained in:
Half-Shot
2024-12-17 11:51:02 +00:00
6 changed files with 160 additions and 14 deletions

View File

@@ -5,10 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only
Please see LICENSE in the repository root for full details.
*/
import { expect, test } from "vitest";
import { expect, test, afterEach } from "vitest";
import { render } from "@testing-library/react";
import { type ReactNode, useState } from "react";
import { afterEach } from "node:test";
import userEvent from "@testing-library/user-event";
import { Modal } from "./Modal";

View File

@@ -13,8 +13,8 @@ import {
type MockedFunction,
test,
vitest,
afterEach,
} from "vitest";
import { afterEach } from "node:test";
import { act } from "react";
import { type CallMembership } from "matrix-js-sdk/src/matrixrtc";

View File

@@ -8,6 +8,7 @@ Please see LICENSE in the repository root for full details.
import { render } from "@testing-library/react";
import {
afterAll,
afterEach,
beforeEach,
expect,
test,
@@ -17,7 +18,6 @@ import {
} from "vitest";
import { TooltipProvider } from "@vector-im/compound-web";
import { act, type ReactNode } from "react";
import { afterEach } from "node:test";
import { ReactionsAudioRenderer } from "./ReactionAudioRenderer";
import {

View File

@@ -6,9 +6,8 @@ Please see LICENSE in the repository root for full details.
*/
import { render } from "@testing-library/react";
import { expect, test } from "vitest";
import { expect, test, afterEach } from "vitest";
import { act } from "react";
import { afterEach } from "node:test";
import { showReactions } from "../settings/settings";
import { ReactionsOverlay } from "./ReactionsOverlay";
@@ -42,7 +41,10 @@ test("shows a reaction when sent", () => {
const reaction = ReactionSet[0];
act(() => {
reactionsSubject$.next({
[aliceRtcMember.deviceId]: { reactionOption: reaction, expireAfter: 0 },
[aliceRtcMember.deviceId]: {
reactionOption: reaction,
expireAfter: new Date(0),
},
});
});
const span = getByRole("presentation");
@@ -60,8 +62,14 @@ test("shows two of the same reaction when sent", () => {
const { getAllByRole } = render(<ReactionsOverlay vm={vm} />);
act(() => {
reactionsSubject$.next({
[aliceRtcMember.deviceId]: { reactionOption: reaction, expireAfter: 0 },
[bobRtcMember.deviceId]: { reactionOption: reaction, expireAfter: 0 },
[aliceRtcMember.deviceId]: {
reactionOption: reaction,
expireAfter: new Date(0),
},
[bobRtcMember.deviceId]: {
reactionOption: reaction,
expireAfter: new Date(0),
},
});
});
expect(getAllByRole("presentation")).toHaveLength(2);
@@ -77,8 +85,14 @@ test("shows two different reactions when sent", () => {
const { getAllByRole } = render(<ReactionsOverlay vm={vm} />);
act(() => {
reactionsSubject$.next({
[aliceRtcMember.deviceId]: { reactionOption: reactionA, expireAfter: 0 },
[bobRtcMember.deviceId]: { reactionOption: reactionB, expireAfter: 0 },
[aliceRtcMember.deviceId]: {
reactionOption: reactionA,
expireAfter: new Date(0),
},
[bobRtcMember.deviceId]: {
reactionOption: reactionB,
expireAfter: new Date(0),
},
});
});
const [reactionElementA, reactionElementB] = getAllByRole("presentation");
@@ -96,7 +110,10 @@ test("hides reactions when reaction animations are disabled", () => {
const { container } = render(<ReactionsOverlay vm={vm} />);
act(() => {
reactionsSubject$.next({
[aliceRtcMember.deviceId]: { reactionOption: reaction, expireAfter: 0 },
[aliceRtcMember.deviceId]: {
reactionOption: reaction,
expireAfter: new Date(0),
},
});
});
expect(container.getElementsByTagName("span")).toHaveLength(0);

View File

@@ -5,10 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only
Please see LICENSE in the repository root for full details.
*/
import { expect, test, vitest } from "vitest";
import { expect, test, vitest, afterEach } from "vitest";
import { type FC } from "react";
import { render } from "@testing-library/react";
import { afterEach } from "node:test";
import userEvent from "@testing-library/user-event";
import { deviceStub, MediaDevicesContext } from "./livekit/MediaDevicesContext";

File diff suppressed because one or more lines are too long