Add confirm end voice broadcast dialog (#9442)
This commit is contained in:
parent
57eec824d9
commit
a61076b4fb
3 changed files with 58 additions and 5 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue