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

Commit

Permalink
test for widget action ack
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Jul 25, 2024
1 parent 12ea8ed commit 14de45f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/stores/widgets/ElementWidgetActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ 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
TileLayout = "io.element.tile_layout",
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
Expand Down
12 changes: 12 additions & 0 deletions test/models/Call-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 14de45f

Please sign in to comment.