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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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();
});