mirror of
https://github.com/element-hq/element-call.git
synced 2026-10-23 19:32:31 +00:00
Merge remote-tracking branch 'origin/livekit' into hs/reactions-viewcallmodel
This commit is contained in:
commit
f2165541f1
6 files changed
+160
-14
No files matched your search
+1
-2
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// vitest.config.js
|
||||
import {
|
||||
defineConfig as defineConfig2,
|
||||
mergeConfig,
|
||||
} from "file:///home/will/git/element-call/node_modules/vitest/dist/config.js";
|
||||
|
||||
// vite.config.js
|
||||
import {
|
||||
defineConfig,
|
||||
loadEnv,
|
||||
} from "file:///home/will/git/element-call/node_modules/vite/dist/node/index.js";
|
||||
import { compression } from "file:///home/will/git/element-call/node_modules/vite-plugin-compression2/dist/index.mjs";
|
||||
import svgrPlugin from "file:///home/will/git/element-call/node_modules/vite-plugin-svgr/dist/index.js";
|
||||
import htmlTemplate from "file:///home/will/git/element-call/node_modules/vite-plugin-html-template/dist/index.js";
|
||||
import { codecovVitePlugin } from "file:///home/will/git/element-call/node_modules/@codecov/vite-plugin/dist/index.mjs";
|
||||
import { sentryVitePlugin } from "file:///home/will/git/element-call/node_modules/@sentry/vite-plugin/dist/esm/index.mjs";
|
||||
import react from "file:///home/will/git/element-call/node_modules/@vitejs/plugin-react/dist/index.mjs";
|
||||
import basicSsl from "file:///home/will/git/element-call/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs";
|
||||
var vite_config_default = defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
const plugins = [
|
||||
react(),
|
||||
basicSsl(),
|
||||
svgrPlugin({
|
||||
svgrOptions: {
|
||||
// This enables ref forwarding on SVGR components, which is needed, for
|
||||
// example, to make tooltips on icons work
|
||||
ref: true,
|
||||
},
|
||||
}),
|
||||
htmlTemplate.default({
|
||||
data: {
|
||||
title: env.VITE_PRODUCT_NAME || "Element Call",
|
||||
},
|
||||
}),
|
||||
codecovVitePlugin({
|
||||
enableBundleAnalysis: process.env.CODECOV_TOKEN !== void 0,
|
||||
bundleName: "element-call",
|
||||
uploadToken: process.env.CODECOV_TOKEN,
|
||||
}),
|
||||
compression({
|
||||
exclude: [/config.json/],
|
||||
}),
|
||||
];
|
||||
if (
|
||||
process.env.SENTRY_ORG &&
|
||||
process.env.SENTRY_PROJECT &&
|
||||
process.env.SENTRY_AUTH_TOKEN &&
|
||||
process.env.SENTRY_URL
|
||||
) {
|
||||
plugins.push(
|
||||
sentryVitePlugin({
|
||||
include: "./dist",
|
||||
release: process.env.VITE_APP_VERSION,
|
||||
}),
|
||||
);
|
||||
}
|
||||
return {
|
||||
server: {
|
||||
port: 3e3,
|
||||
},
|
||||
build: {
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
assetFileNames: ({ originalFileNames }) => {
|
||||
if (originalFileNames) {
|
||||
for (const name of originalFileNames) {
|
||||
const match = name.match(/locales\/([^/]+)\/(.+)\.json$/);
|
||||
if (match) {
|
||||
const [, locale, filename] = match;
|
||||
return `assets/${locale}-${filename}-[hash].json`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "assets/[name]-[hash][extname]";
|
||||
},
|
||||
manualChunks: {
|
||||
// we should be able to remove this one https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/pull/167 lands
|
||||
"matrix-sdk-crypto-wasm": ["@matrix-org/matrix-sdk-crypto-wasm"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins,
|
||||
resolve: {
|
||||
alias: {
|
||||
// matrix-widget-api has its transpiled lib/index.js as its entry point,
|
||||
// which Vite for some reason refuses to work with, so we point it to
|
||||
// src/index.ts instead
|
||||
"matrix-widget-api": "matrix-widget-api/src/index.ts",
|
||||
},
|
||||
dedupe: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"matrix-js-sdk",
|
||||
"react-use-measure",
|
||||
// These packages modify the document based on some module-level global
|
||||
// state, and don't play nicely with duplicate copies of themselves
|
||||
// https://github.com/radix-ui/primitives/issues/1241#issuecomment-1847837850
|
||||
"@radix-ui/react-focus-guards",
|
||||
"@radix-ui/react-dismissable-layer",
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// vitest.config.js
|
||||
var vitest_config_default = defineConfig2((configEnv) =>
|
||||
mergeConfig(
|
||||
vite_config_default(configEnv),
|
||||
defineConfig2({
|
||||
test: {
|
||||
environment: "jsdom",
|
||||
css: {
|
||||
modules: {
|
||||
classNameStrategy: "non-scoped",
|
||||
},
|
||||
},
|
||||
setupFiles: ["src/vitest.setup.ts"],
|
||||
coverage: {
|
||||
reporter: ["html", "json"],
|
||||
include: ["src/"],
|
||||
exclude: ["src/**/*.{d,test}.{ts,tsx}", "src/utils/test.ts"],
|
||||
},
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
export { vitest_config_default as default };
|
||||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZXN0LmNvbmZpZy5qcyIsICJ2aXRlLmNvbmZpZy5qcyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiY29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2Rpcm5hbWUgPSBcIi9ob21lL3dpbGwvZ2l0L2VsZW1lbnQtY2FsbFwiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9maWxlbmFtZSA9IFwiL2hvbWUvd2lsbC9naXQvZWxlbWVudC1jYWxsL3Zpd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aF0uanNvbmA7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIERlZmF1bHQgbmFtaW5nIGZhbGxiYWNrXG4gICAgICAgICAgICByZXR1cm4gXCJhc3NldHMvW25hbWVdLVtoYXNoXVtleHRuYW1lXVwiO1xuICAgICAgICAgIH0sXG4gICAgICAgICAgbWFudWFsQ2h1bmtzO
Line truncated
|
||||
Reference in new issue
Block a user