Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 14de45f

Browse files
committed
test for widget action ack
1 parent 12ea8ed commit 14de45f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/stores/widgets/ElementWidgetActions.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,18 @@ export enum ElementWidgetActions {
2121
JoinCall = "io.element.join",
2222
HangupCall = "im.vector.hangup",
2323
CallParticipants = "io.element.participants",
24-
MuteVideo = "io.element.mute_video",
25-
UnmuteVideo = "io.element.unmute_video",
2624
StartLiveStream = "im.vector.start_live_stream",
2725

2826
// Actions for switching layouts
2927
TileLayout = "io.element.tile_layout",
3028
SpotlightLayout = "io.element.spotlight_layout",
3129

3230
OpenIntegrationManager = "integration_manager_open",
33-
3431
/**
3532
* @deprecated Use MSC2931 instead
3633
*/
3734
ViewRoom = "io.element.view_room",
35+
3836
// This action type is used as a `fromWidget` and a `toWidget` action.
3937
// fromWidget: updates the client about the current device mute state
4038
// toWidget: the client requests a specific device mute configuration

test/models/Call-test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,18 @@ describe("ElementCall", () => {
965965
expect(messaging.transport.send).toHaveBeenCalledWith(ElementWidgetActions.TileLayout, {});
966966
});
967967

968+
it("acknowledges mute_device widget action", async () => {
969+
await callConnectProcedure(call);
970+
const preventDefault = jest.fn();
971+
const mockEv = {
972+
preventDefault,
973+
detail: { video_enabled: false },
974+
};
975+
messaging.emit(`action:${ElementWidgetActions.DeviceMute}`, mockEv);
976+
expect(messaging.transport.reply).toHaveBeenCalledWith({ video_enabled: false }, {});
977+
expect(preventDefault).toHaveBeenCalled();
978+
});
979+
968980
it("emits events when connection state changes", async () => {
969981
// const wait = jest.spyOn(CallModule, "waitForEvent");
970982
const onConnectionState = jest.fn();

0 commit comments

Comments
 (0)