mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-31 07:00:26 +00:00
* make tiles based on rtc member
* display missing lk participant + fix tile multiplier
* add show_non_member_participants config option
* per member tiles
* merge fixes
* linter
* linter and tests
* tests
* adapt tests (wip)
* Remove unused keys
* Fix optionality of nonMemberItemCount
* video is optional
* Mock RTC members
* Lint
* Merge fixes
* Fix user id
* Add explicit types for public fields
* isRTCParticipantAvailable => isLiveKitParticipantAvailable
* isLiveKitParticipantAvailable
* Readonly
* More keys removal
* Make local field based on view model class not observable
* Wording
* Fix RTC members in tes
* Tests again
* Lint
* Disable showing non-member tiles by default
* Duplicate screen sharing tiles like we used to
* Lint
* Revert function reordering
* Remove throttleTime from bad merge
* Cleanup
* Tidy config of show non-member settings
* tidy up handling of local rtc member in tests
* tidy up test init
* Fix mocks
* Cleanup
* Apply local override where participant not yet known
* Handle no visible media id
* Assertions for one-on-one view
* Remove isLiveKitParticipantAvailable and show via encryption status
* Handle no local media (yet)
* Remove unused effect for setting
* Tidy settings
* Avoid case of one-to-one layout with missing local or remote
* Iterate
* Remove option to show non-member tiles to simplify code review
* Remove unused code
* Remove more remnants of show-non-member-tiles
* iterate
* back
* Fix unit test
* Refactor
* Expose TestScheduler as global
* Fix incorrect type assertion
* Simplify speaking observer
* Fix
* Whitespace
* Make it clear that we are mocking MatrixRTC memberships
* Test case for only showing tiles for MatrixRTC session members
* Simplify diff
* Simplify diff
These changes are in https://github.com/element-hq/element-call/pull/2809
* .
* Whitespaces
* Use asObservable when exposing subject
* Show "waiting for media..." when no participant
* Additional test case
* Don't show "waiting for media..." in case of local participant
* Make the loading state more subtle
- instead of a label we show a animated gradient
* Use correct key for matrix rtc foci in code comment. (#2838)
* Update src/tile/SpotlightTile.tsx
Co-authored-by: Timo <16718859+toger5@users.noreply.github.com>
* Update src/state/CallViewModel.ts
Co-authored-by: Timo <16718859+toger5@users.noreply.github.com>
* Make the purpose of BaseMediaViewModel.local explicit
* Use named object instead of unnamed array for spotlightAndPip
* Refactor spotlightAndPip into spotlight and pip
* Use if statement instead of ternary for readability in spotlight and pip logic
* Review feedback
* Fix tests for CallEventAudioRenderer
* Lint
* Revert "Make the loading state more subtle"
This reverts commit 765f7b4f31.
* Update src/state/CallViewModel.ts
Co-authored-by: Timo <16718859+toger5@users.noreply.github.com>
* Fix spelling
* Remove a non-null assertion that failed at runtime
---------
Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com>
81 lines
2.6 KiB
TypeScript
81 lines
2.6 KiB
TypeScript
/*
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import { test, expect, vi } from "vitest";
|
|
import { isInaccessible, render, screen } from "@testing-library/react";
|
|
import { axe } from "vitest-axe";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { of } from "rxjs";
|
|
|
|
import { SpotlightTile } from "./SpotlightTile";
|
|
import {
|
|
mockRtcMembership,
|
|
withLocalMedia,
|
|
withRemoteMedia,
|
|
} from "../utils/test";
|
|
import { SpotlightTileViewModel } from "../state/TileViewModel";
|
|
|
|
global.IntersectionObserver = class MockIntersectionObserver {
|
|
public observe(): void {}
|
|
public unobserve(): void {}
|
|
} as unknown as typeof IntersectionObserver;
|
|
|
|
test("SpotlightTile is accessible", async () => {
|
|
await withRemoteMedia(
|
|
mockRtcMembership("@alice:example.org", "AAAA"),
|
|
{
|
|
rawDisplayName: "Alice",
|
|
getMxcAvatarUrl: () => "mxc://adfsg",
|
|
},
|
|
{},
|
|
async (vm1) => {
|
|
await withLocalMedia(
|
|
mockRtcMembership("@bob:example.org", "BBBB"),
|
|
{
|
|
rawDisplayName: "Bob",
|
|
getMxcAvatarUrl: () => "mxc://dlskf",
|
|
},
|
|
async (vm2) => {
|
|
const user = userEvent.setup();
|
|
const toggleExpanded = vi.fn();
|
|
const { container } = render(
|
|
<SpotlightTile
|
|
vm={new SpotlightTileViewModel(of([vm1, vm2]), of(false))}
|
|
targetWidth={300}
|
|
targetHeight={200}
|
|
expanded={false}
|
|
onToggleExpanded={toggleExpanded}
|
|
showIndicators
|
|
/>,
|
|
);
|
|
|
|
expect(await axe(container)).toHaveNoViolations();
|
|
// Alice should be in the spotlight, with her name and avatar on the
|
|
// first page
|
|
screen.getByText("Alice");
|
|
const aliceAvatar = screen.getByRole("img");
|
|
expect(screen.queryByRole("button", { name: "common.back" })).toBe(
|
|
null,
|
|
);
|
|
// Bob should be out of the spotlight, and therefore invisible
|
|
expect(isInaccessible(screen.getByText("Bob"))).toBe(true);
|
|
// Now navigate to Bob
|
|
await user.click(screen.getByRole("button", { name: "common.next" }));
|
|
screen.getByText("Bob");
|
|
expect(screen.getByRole("img")).not.toBe(aliceAvatar);
|
|
expect(isInaccessible(screen.getByText("Alice"))).toBe(true);
|
|
// Can toggle whether the tile is expanded
|
|
await user.click(
|
|
screen.getByRole("button", { name: "video_tile.expand" }),
|
|
);
|
|
expect(toggleExpanded).toHaveBeenCalled();
|
|
},
|
|
);
|
|
},
|
|
);
|
|
});
|