From 14de45fc744e113b9e6af4c740b1e9f5099053d7 Mon Sep 17 00:00:00 2001 From: Timo Date: Thu, 25 Jul 2024 11:11:16 +0200 Subject: [PATCH] test for widget action ack --- src/stores/widgets/ElementWidgetActions.ts | 4 +--- test/models/Call-test.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/stores/widgets/ElementWidgetActions.ts b/src/stores/widgets/ElementWidgetActions.ts index e56a547aa70..593f181843d 100644 --- a/src/stores/widgets/ElementWidgetActions.ts +++ b/src/stores/widgets/ElementWidgetActions.ts @@ -21,8 +21,6 @@ export enum ElementWidgetActions { JoinCall = "io.element.join", HangupCall = "im.vector.hangup", CallParticipants = "io.element.participants", - MuteVideo = "io.element.mute_video", - UnmuteVideo = "io.element.unmute_video", StartLiveStream = "im.vector.start_live_stream", // Actions for switching layouts @@ -30,11 +28,11 @@ export enum ElementWidgetActions { SpotlightLayout = "io.element.spotlight_layout", OpenIntegrationManager = "integration_manager_open", - /** * @deprecated Use MSC2931 instead */ ViewRoom = "io.element.view_room", + // This action type is used as a `fromWidget` and a `toWidget` action. // fromWidget: updates the client about the current device mute state // toWidget: the client requests a specific device mute configuration diff --git a/test/models/Call-test.ts b/test/models/Call-test.ts index 5748b507ac1..85f0700cb1b 100644 --- a/test/models/Call-test.ts +++ b/test/models/Call-test.ts @@ -965,6 +965,18 @@ describe("ElementCall", () => { expect(messaging.transport.send).toHaveBeenCalledWith(ElementWidgetActions.TileLayout, {}); }); + it("acknowledges mute_device widget action", async () => { + await callConnectProcedure(call); + const preventDefault = jest.fn(); + const mockEv = { + preventDefault, + detail: { video_enabled: false }, + }; + messaging.emit(`action:${ElementWidgetActions.DeviceMute}`, mockEv); + expect(messaging.transport.reply).toHaveBeenCalledWith({ video_enabled: false }, {}); + expect(preventDefault).toHaveBeenCalled(); + }); + it("emits events when connection state changes", async () => { // const wait = jest.spyOn(CallModule, "waitForEvent"); const onConnectionState = jest.fn();