1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-09 08:42:50 +03:00

Implement small broadcast PiP (#9755)

This commit is contained in:
Michael Weimann
2022-12-15 12:43:01 +01:00
committed by GitHub
parent 9f795a4c5f
commit ab560bba40
21 changed files with 938 additions and 74 deletions

View File

@@ -193,7 +193,7 @@ describe("PipView", () => {
new RoomViewStore(defaultDispatcher, sdkContext);
};
const startVoiceBroadcastPlayback = (room: Room): MatrixEvent => {
const mkVoiceBroadcast = (room: Room): MatrixEvent => {
const infoEvent = makeVoiceBroadcastInfoStateEvent();
room.currentState.setStateEvents([infoEvent]);
defaultDispatcher.dispatch<IRoomStateEventsActionPayload>(
@@ -278,7 +278,7 @@ describe("PipView", () => {
describe("when there is a voice broadcast playback and pre-recording", () => {
beforeEach(() => {
startVoiceBroadcastPlayback(room);
mkVoiceBroadcast(room);
setUpVoiceBroadcastPreRecording();
renderPip();
});
@@ -301,13 +301,31 @@ describe("PipView", () => {
});
});
describe("when listening to a voice broadcast in a room and then switching to another room", () => {
beforeEach(async () => {
setUpRoomViewStore();
viewRoom(room.roomId);
mkVoiceBroadcast(room);
await voiceBroadcastPlaybacksStore.getCurrent()?.start();
viewRoom(room2.roomId);
renderPip();
});
it("should render the small voice broadcast playback PiP", () => {
// check for the „pause voice broadcast“ button
expect(screen.getByLabelText("pause voice broadcast")).toBeInTheDocument();
// check for the absence of the „30s forward“ button
expect(screen.queryByLabelText("30s forward")).not.toBeInTheDocument();
});
});
describe("when viewing a room with a live voice broadcast", () => {
let startEvent: MatrixEvent | null = null;
let startEvent!: MatrixEvent;
beforeEach(() => {
setUpRoomViewStore();
viewRoom(room.roomId);
startEvent = startVoiceBroadcastPlayback(room);
startEvent = mkVoiceBroadcast(room);
renderPip();
});