mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
lint
This commit is contained in:
@@ -94,8 +94,6 @@ Please see LICENSE in the repository root for full details.
|
|||||||
justify-self: end;
|
justify-self: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 370px) {
|
@media (max-width: 370px) {
|
||||||
.raiseHand {
|
.raiseHand {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -167,4 +165,4 @@ Please see LICENSE in the repository root for full details.
|
|||||||
.tile.maximised {
|
.tile.maximised {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,10 +85,7 @@ import handSoundOgg from "../sound/raise_hand.ogg?url";
|
|||||||
import handSoundMp3 from "../sound/raise_hand.mp3?url";
|
import handSoundMp3 from "../sound/raise_hand.mp3?url";
|
||||||
import { ReactionsAudioRenderer } from "./ReactionAudioRenderer";
|
import { ReactionsAudioRenderer } from "./ReactionAudioRenderer";
|
||||||
import { useSwitchCamera } from "./useSwitchCamera";
|
import { useSwitchCamera } from "./useSwitchCamera";
|
||||||
import {
|
import { soundEffectVolumeSetting, useSetting } from "../settings/settings";
|
||||||
soundEffectVolumeSetting,
|
|
||||||
useSetting,
|
|
||||||
} from "../settings/settings";
|
|
||||||
import { ReactionsOverlay } from "./ReactionsOverlay";
|
import { ReactionsOverlay } from "./ReactionsOverlay";
|
||||||
|
|
||||||
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
|
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
|
||||||
|
|||||||
@@ -9,17 +9,15 @@ import { render } from "@testing-library/react";
|
|||||||
import { expect, test } from "vitest";
|
import { expect, test } from "vitest";
|
||||||
import { TooltipProvider } from "@vector-im/compound-web";
|
import { TooltipProvider } from "@vector-im/compound-web";
|
||||||
import { act, ReactNode } from "react";
|
import { act, ReactNode } from "react";
|
||||||
|
import { afterEach } from "node:test";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MockRoom,
|
MockRoom,
|
||||||
MockRTCSession,
|
MockRTCSession,
|
||||||
TestReactionsWrapper,
|
TestReactionsWrapper,
|
||||||
} from "../utils/testReactions";
|
} from "../utils/testReactions";
|
||||||
import {
|
import { showReactions } from "../settings/settings";
|
||||||
showReactions,
|
|
||||||
} from "../settings/settings";
|
|
||||||
import { ReactionsOverlay } from "./ReactionsOverlay";
|
import { ReactionsOverlay } from "./ReactionsOverlay";
|
||||||
import { afterEach } from "node:test";
|
|
||||||
import { ReactionSet } from "../reactions";
|
import { ReactionSet } from "../reactions";
|
||||||
|
|
||||||
const memberUserIdAlice = "@alice:example.org";
|
const memberUserIdAlice = "@alice:example.org";
|
||||||
@@ -49,7 +47,6 @@ function TestComponent({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
showReactions.setValue(showReactions.defaultValue);
|
showReactions.setValue(showReactions.defaultValue);
|
||||||
});
|
});
|
||||||
@@ -61,51 +58,51 @@ test("defaults to showing no reactions", () => {
|
|||||||
membership,
|
membership,
|
||||||
);
|
);
|
||||||
const { container } = render(<TestComponent rtcSession={rtcSession} />);
|
const { container } = render(<TestComponent rtcSession={rtcSession} />);
|
||||||
expect(container.getElementsByTagName("span")).toHaveLength(
|
expect(container.getElementsByTagName("span")).toHaveLength(0);
|
||||||
0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("shows a reaction when sent", () => {
|
test("shows a reaction when sent", () => {
|
||||||
showReactions.setValue(true);
|
showReactions.setValue(true);
|
||||||
const reaction = ReactionSet[0];
|
const reaction = ReactionSet[0];
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
room,
|
|
||||||
membership,
|
|
||||||
);
|
|
||||||
const { getByRole } = render(<TestComponent rtcSession={rtcSession} />);
|
const { getByRole } = render(<TestComponent rtcSession={rtcSession} />);
|
||||||
act(() => room.testSendReaction(memberEventAlice, reaction, membership));
|
act(() => {
|
||||||
const span = getByRole('presentation');
|
room.testSendReaction(memberEventAlice, reaction, membership);
|
||||||
expect(getByRole('presentation')).toBeTruthy();
|
});
|
||||||
|
const span = getByRole("presentation");
|
||||||
|
expect(getByRole("presentation")).toBeTruthy();
|
||||||
expect(span.innerHTML).toEqual(reaction.emoji);
|
expect(span.innerHTML).toEqual(reaction.emoji);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("shows two of the same reaction when sent", () => {
|
test("shows two of the same reaction when sent", () => {
|
||||||
showReactions.setValue(true);
|
showReactions.setValue(true);
|
||||||
|
const reaction = ReactionSet[0];
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
room,
|
|
||||||
membership,
|
|
||||||
);
|
|
||||||
const { getAllByRole } = render(<TestComponent rtcSession={rtcSession} />);
|
const { getAllByRole } = render(<TestComponent rtcSession={rtcSession} />);
|
||||||
act(() => room.testSendReaction(memberEventAlice, ReactionSet[0], membership));
|
act(() => {
|
||||||
act(() => room.testSendReaction(memberEventBob, ReactionSet[0], membership));
|
room.testSendReaction(memberEventAlice, reaction, membership);
|
||||||
expect(getAllByRole('presentation')).toHaveLength(2);
|
});
|
||||||
|
act(() => {
|
||||||
|
room.testSendReaction(memberEventBob, reaction, membership);
|
||||||
|
});
|
||||||
|
expect(getAllByRole("presentation")).toHaveLength(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("shows two different reactions when sent", () => {
|
test("shows two different reactions when sent", () => {
|
||||||
showReactions.setValue(true);
|
showReactions.setValue(true);
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
room,
|
|
||||||
membership,
|
|
||||||
);
|
|
||||||
const [reactionA, reactionB] = ReactionSet;
|
const [reactionA, reactionB] = ReactionSet;
|
||||||
const { getAllByRole } = render(<TestComponent rtcSession={rtcSession} />);
|
const { getAllByRole } = render(<TestComponent rtcSession={rtcSession} />);
|
||||||
act(() => room.testSendReaction(memberEventAlice, reactionA, membership));
|
act(() => {
|
||||||
act(() => room.testSendReaction(memberEventBob, reactionB, membership));
|
room.testSendReaction(memberEventAlice, reactionA, membership);
|
||||||
const [reactionElementA, reactionElementB] = getAllByRole('presentation');
|
});
|
||||||
|
act(() => {
|
||||||
|
room.testSendReaction(memberEventBob, reactionB, membership);
|
||||||
|
});
|
||||||
|
const [reactionElementA, reactionElementB] = getAllByRole("presentation");
|
||||||
expect(reactionElementA.innerHTML).toEqual(reactionA.emoji);
|
expect(reactionElementA.innerHTML).toEqual(reactionA.emoji);
|
||||||
expect(reactionElementB.innerHTML).toEqual(reactionB.emoji);
|
expect(reactionElementB.innerHTML).toEqual(reactionB.emoji);
|
||||||
});
|
});
|
||||||
@@ -114,13 +111,10 @@ test("hides reactions when reaction animations are disabled", () => {
|
|||||||
showReactions.setValue(false);
|
showReactions.setValue(false);
|
||||||
const reaction = ReactionSet[0];
|
const reaction = ReactionSet[0];
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
room,
|
act(() => {
|
||||||
membership,
|
room.testSendReaction(memberEventAlice, reaction, membership);
|
||||||
);
|
});
|
||||||
act(() => room.testSendReaction(memberEventAlice, reaction, membership));
|
|
||||||
const { container } = render(<TestComponent rtcSession={rtcSession} />);
|
const { container } = render(<TestComponent rtcSession={rtcSession} />);
|
||||||
expect(container.getElementsByTagName("span")).toHaveLength(
|
expect(container.getElementsByTagName("span")).toHaveLength(0);
|
||||||
0
|
});
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ interface RaisedHandInfo {
|
|||||||
time: Date;
|
time: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
const REACTION_ACTIVE_TIME_MS = 3000;
|
const REACTION_ACTIVE_TIME_MS = 90000;
|
||||||
|
|
||||||
export const useReactions = (): ReactionsContextType => {
|
export const useReactions = (): ReactionsContextType => {
|
||||||
const context = useContext(ReactionsContext);
|
const context = useContext(ReactionsContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user