Add confirm end voice broadcast dialog (#9442)

This commit is contained in:
Michael Weimann 2022-10-18 09:12:28 +02:00 committed by GitHub
parent 57eec824d9
commit a61076b4fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 5 deletions

View file

@ -16,11 +16,14 @@ limitations under the License.
//
import React from "react";
import { render, RenderResult } from "@testing-library/react";
import { render, RenderResult, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { MatrixClient, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { sleep } from "matrix-js-sdk/src/utils";
import {
VoiceBroadcastInfoEventType,
VoiceBroadcastInfoState,
VoiceBroadcastRecording,
VoiceBroadcastRecordingPip,
} from "../../../../src/voice-broadcast";
@ -63,5 +66,27 @@ describe("VoiceBroadcastRecordingPip", () => {
it("should create the expected result", () => {
expect(renderResult.container).toMatchSnapshot();
});
describe("and clicking the stop button", () => {
beforeEach(async () => {
await userEvent.click(screen.getByLabelText("stop voice broadcast"));
// modal rendering has some weird sleeps
await sleep(100);
});
it("should display the confirm end dialog", () => {
screen.getByText("Stop live broadcasting?");
});
describe("and confirming the dialog", () => {
beforeEach(async () => {
await userEvent.click(screen.getByText("Yes, stop broadcast"));
});
it("should end the recording", () => {
expect(recording.getState()).toBe(VoiceBroadcastInfoState.Stopped);
});
});
});
});
});