Optimise Jest run in CI (#9542)

This commit is contained in:
Michael Telatynski 2022-11-04 10:48:08 +00:00 committed by GitHub
parent 28ecdc0cb4
commit 04bc8fb71c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 1388 additions and 1305 deletions

View file

@ -25,8 +25,12 @@ jobs:
- name: Install Deps
run: "./scripts/ci/install-deps.sh --ignore-scripts"
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1
- name: Run tests with coverage
run: "yarn coverage --ci"
run: "yarn coverage --ci --reporters github-actions --max-workers ${{ steps.cpu-cores.outputs.count }}"
- name: Upload Artifact
uses: actions/upload-artifact@v2

View file

@ -137,7 +137,7 @@
"@babel/traverse": "^7.12.12",
"@casualbot/jest-sonar-reporter": "^2.2.5",
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
"@peculiar/webcrypto": "^1.1.4",
"@peculiar/webcrypto": "^1.4.1",
"@percy/cli": "^1.11.0",
"@percy/cypress": "^3.1.2",
"@sentry/types": "^6.10.0",
@ -155,7 +155,7 @@
"@types/file-saver": "^2.0.3",
"@types/flux": "^3.1.9",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^26.0.20",
"@types/jest": "^29.2.1",
"@types/katex": "^0.14.0",
"@types/lodash": "^4.14.168",
"@types/modernizr": "^3.5.3",
@ -195,10 +195,10 @@
"fetch-mock-jest": "^1.5.1",
"fs-extra": "^10.0.1",
"glob": "^7.1.6",
"jest": "^27.4.0",
"jest": "^29.2.2",
"jest-canvas-mock": "^2.3.0",
"jest-environment-jsdom": "^27.0.6",
"jest-mock": "^27.5.1",
"jest-environment-jsdom": "^29.2.2",
"jest-mock": "^29.2.2",
"jest-raw-loader": "^1.0.1",
"matrix-mock-request": "^2.5.0",
"matrix-web-i18n": "^1.3.0",

View file

@ -63,9 +63,9 @@ describe("ContentMessages", () => {
describe("sendStickerContentToRoom", () => {
beforeEach(() => {
mocked(client.sendStickerMessage).mockReturnValue(prom);
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
client?: MatrixClient,
) => {
return fn(roomId);
@ -100,9 +100,9 @@ describe("ContentMessages", () => {
Object.defineProperty(global.Image.prototype, 'width', {
get() { return 800; },
});
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
) => fn(roomId));
mocked(BlurhashEncoder.instance.getBlurhash).mockResolvedValue(undefined);
});
@ -196,9 +196,9 @@ describe("ContentMessages", () => {
const roomId = "!roomId:server";
beforeEach(() => {
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
) => fn(roomId));
});

View file

@ -25,7 +25,7 @@ import SettingsStore from '../src/settings/SettingsStore';
jest.mock("../src/settings/SettingsStore");
const enableHtmlTopicFeature = () => {
mocked(SettingsStore).getValue.mockImplementation((arg) => {
mocked(SettingsStore).getValue.mockImplementation((arg): any => {
return arg === "feature_html_topic";
});
};

View file

@ -158,7 +158,7 @@ describe("Notifier", () => {
it('does not create notifications for own event', () => {
const ownEvent = new MatrixEvent({ sender: userId });
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing);
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing, null);
mockClient!.emit(ClientEvent.Event, ownEvent);
expect(MockPlatform.displayNotification).not.toHaveBeenCalled();
@ -173,7 +173,7 @@ describe("Notifier", () => {
},
});
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing);
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing, null);
mockClient!.emit(ClientEvent.Event, event);
expect(MockPlatform.displayNotification).not.toHaveBeenCalled();
@ -181,7 +181,7 @@ describe("Notifier", () => {
});
it('creates desktop notification when enabled', () => {
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing);
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing, null);
mockClient!.emit(ClientEvent.Event, event);
expect(MockPlatform.displayNotification).toHaveBeenCalledWith(
@ -194,7 +194,7 @@ describe("Notifier", () => {
});
it('creates a loud notification when enabled', () => {
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing);
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing, null);
mockClient!.emit(ClientEvent.Event, event);
expect(MockPlatform.loudNotification).toHaveBeenCalledWith(
@ -210,7 +210,7 @@ describe("Notifier", () => {
},
});
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing);
mockClient!.emit(ClientEvent.Sync, SyncState.Syncing, null);
mockClient!.emit(ClientEvent.Event, event);
// desktop notification created

View file

@ -1,46 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Reply getNestedReplyText Returns valid reply fallback text for m.text msgtypes 1`] = `
Object {
{
"body": "> <@user1:server> body
",
"html": "<mx-reply><blockquote><a href=\\"$$permalink$$\\">In reply to</a> <a href=\\"https://matrix.to/#/@user1:server\\">@user1:server</a><br>body</blockquote></mx-reply>",
"html": "<mx-reply><blockquote><a href="$$permalink$$">In reply to</a> <a href="https://matrix.to/#/@user1:server">@user1:server</a><br>body</blockquote></mx-reply>",
}
`;
exports[`Reply getNestedReplyText should create the expected fallback text for m.pin m.room.message/m.location 1`] = `
Object {
{
"body": "> <@user1:server> shared a location.
",
"html": "<mx-reply><blockquote><a href=\\"$$permalink$$\\">In reply to</a> <a href=\\"https://matrix.to/#/@user1:server\\">@user1:server</a><br>shared a location.</blockquote></mx-reply>",
"html": "<mx-reply><blockquote><a href="$$permalink$$">In reply to</a> <a href="https://matrix.to/#/@user1:server">@user1:server</a><br>shared a location.</blockquote></mx-reply>",
}
`;
exports[`Reply getNestedReplyText should create the expected fallback text for m.pin org.matrix.msc3672.beacon_info/undefined 1`] = `
Object {
{
"body": "> <@user1:server> shared a live location.
",
"html": "<mx-reply><blockquote><a href=\\"$$permalink$$\\">In reply to</a> <a href=\\"https://matrix.to/#/@user1:server\\">@user1:server</a><br>shared a live location.</blockquote></mx-reply>",
"html": "<mx-reply><blockquote><a href="$$permalink$$">In reply to</a> <a href="https://matrix.to/#/@user1:server">@user1:server</a><br>shared a live location.</blockquote></mx-reply>",
}
`;
exports[`Reply getNestedReplyText should create the expected fallback text for m.self m.room.message/m.location 1`] = `
Object {
{
"body": "> <@user1:server> shared their location.
",
"html": "<mx-reply><blockquote><a href=\\"$$permalink$$\\">In reply to</a> <a href=\\"https://matrix.to/#/@user1:server\\">@user1:server</a><br>shared their location.</blockquote></mx-reply>",
"html": "<mx-reply><blockquote><a href="$$permalink$$">In reply to</a> <a href="https://matrix.to/#/@user1:server">@user1:server</a><br>shared their location.</blockquote></mx-reply>",
}
`;
exports[`Reply getNestedReplyText should create the expected fallback text for m.self org.matrix.msc3672.beacon_info/undefined 1`] = `
Object {
{
"body": "> <@user1:server> shared their live location.
",
"html": "<mx-reply><blockquote><a href=\\"$$permalink$$\\">In reply to</a> <a href=\\"https://matrix.to/#/@user1:server\\">@user1:server</a><br>shared their live location.</blockquote></mx-reply>",
"html": "<mx-reply><blockquote><a href="$$permalink$$">In reply to</a> <a href="https://matrix.to/#/@user1:server">@user1:server</a><br>shared their live location.</blockquote></mx-reply>",
}
`;

View file

@ -199,7 +199,7 @@ describe("VoiceMessageRecording", () => {
describe("getPlayback", () => {
beforeEach(() => {
mocked(Playback).mockImplementation((buf: ArrayBuffer, seedWaveform) => {
mocked(Playback).mockImplementation((buf: ArrayBuffer, seedWaveform): any => {
expect(new Uint8Array(buf)).toEqual(testBuf);
expect(seedWaveform).toEqual(testAmplitudes);
return {} as Playback;

View file

@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`RoomView for a local room in state CREATING should match the snapshot 1`] = `"<div class=\\"mx_RoomView mx_RoomView--local\\"><header class=\\"mx_RoomHeader light-panel\\"><div class=\\"mx_RoomHeader_wrapper\\"><div class=\\"mx_RoomHeader_avatar\\"><div class=\\"mx_DecoratedRoomAvatar\\"><span class=\\"mx_BaseAvatar\\" role=\\"presentation\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 15.600000000000001px; width: 24px; line-height: 24px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 24px; height: 24px;\\" aria-hidden=\\"true\\"></span></div></div><div class=\\"mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon\\"></div><div class=\\"mx_RoomHeader_name mx_RoomHeader_name--textonly\\"><div dir=\\"auto\\" class=\\"mx_RoomHeader_nametext\\" title=\\"@user:example.com\\" role=\\"heading\\" aria-level=\\"1\\">@user:example.com</div></div><div class=\\"mx_RoomHeader_topic mx_RoomTopic\\" dir=\\"auto\\"><div tabindex=\\"0\\"><div><span dir=\\"auto\\"></span></div></div></div></div></header><div class=\\"mx_RoomView_body\\"><div class=\\"mx_LargeLoader\\"><div class=\\"mx_Spinner\\"><div class=\\"mx_Spinner_icon\\" style=\\"width: 45px; height: 45px;\\" aria-label=\\"Loading...\\" role=\\"progressbar\\" data-testid=\\"spinner\\"></div></div><div class=\\"mx_LargeLoader_text\\">We're creating a room with @user:example.com</div></div></div></div>"`;
exports[`RoomView for a local room in state CREATING should match the snapshot 1`] = `"<div class="mx_RoomView mx_RoomView--local"><header class="mx_RoomHeader light-panel"><div class="mx_RoomHeader_wrapper"><div class="mx_RoomHeader_avatar"><div class="mx_DecoratedRoomAvatar"><span class="mx_BaseAvatar" role="presentation"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 15.600000000000001px; width: 24px; line-height: 24px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 24px; height: 24px;" aria-hidden="true"></span></div></div><div class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"></div><div class="mx_RoomHeader_name mx_RoomHeader_name--textonly"><div dir="auto" class="mx_RoomHeader_nametext" title="@user:example.com" role="heading" aria-level="1">@user:example.com</div></div><div class="mx_RoomHeader_topic mx_RoomTopic" dir="auto"><div tabindex="0"><div><span dir="auto"></span></div></div></div></div></header><div class="mx_RoomView_body"><div class="mx_LargeLoader"><div class="mx_Spinner"><div class="mx_Spinner_icon" style="width: 45px; height: 45px;" aria-label="Loading..." role="progressbar" data-testid="spinner"></div></div><div class="mx_LargeLoader_text">We're creating a room with @user:example.com</div></div></div></div>"`;
exports[`RoomView for a local room in state ERROR should match the snapshot 1`] = `"<div class=\\"mx_RoomView mx_RoomView--local\\"><header class=\\"mx_RoomHeader light-panel\\"><div class=\\"mx_RoomHeader_wrapper\\"><div class=\\"mx_RoomHeader_avatar\\"><div class=\\"mx_DecoratedRoomAvatar\\"><span class=\\"mx_BaseAvatar\\" role=\\"presentation\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 15.600000000000001px; width: 24px; line-height: 24px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 24px; height: 24px;\\" aria-hidden=\\"true\\"></span></div></div><div class=\\"mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon\\"></div><div class=\\"mx_RoomHeader_name mx_RoomHeader_name--textonly\\"><div dir=\\"auto\\" class=\\"mx_RoomHeader_nametext\\" title=\\"@user:example.com\\" role=\\"heading\\" aria-level=\\"1\\">@user:example.com</div></div><div class=\\"mx_RoomHeader_topic mx_RoomTopic\\" dir=\\"auto\\"><div tabindex=\\"0\\"><div><span dir=\\"auto\\"></span></div></div></div></div></header><main class=\\"mx_RoomView_body\\"><div class=\\"mx_RoomView_timeline\\"><div class=\\"mx_AutoHideScrollbar mx_ScrollPanel mx_RoomView_messagePanel\\" tabindex=\\"-1\\"><div class=\\"mx_RoomView_messageListWrapper\\"><ol class=\\"mx_RoomView_MessageList\\" aria-live=\\"polite\\" style=\\"height: 400px;\\"><li class=\\"mx_NewRoomIntro\\"><div class=\\"mx_EventTileBubble mx_cryptoEvent mx_cryptoEvent_icon_warning\\"><div class=\\"mx_EventTileBubble_title\\">End-to-end encryption isn't enabled</div><div class=\\"mx_EventTileBubble_subtitle\\"><span> Your private messages are normally encrypted, but this room isn't. Usually this is due to an unsupported device or method being used, like email invites. </span></div></div><span aria-label=\\"Avatar\\" aria-live=\\"off\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_BaseAvatar\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 33.800000000000004px; width: 52px; line-height: 52px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 52px; height: 52px;\\" aria-hidden=\\"true\\"></span><h2>@user:example.com</h2><p><span>Send your first message to invite <b>@user:example.com</b> to chat</span></p></li></ol></div></div></div><div class=\\"mx_RoomStatusBar mx_RoomStatusBar_unsentMessages\\"><div role=\\"alert\\"><div class=\\"mx_RoomStatusBar_unsentBadge\\"><div class=\\"mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_highlighted mx_NotificationBadge_2char\\"><span class=\\"mx_NotificationBadge_count\\">!</span></div></div><div><div class=\\"mx_RoomStatusBar_unsentTitle\\">Some of your messages have not been sent</div></div><div class=\\"mx_RoomStatusBar_unsentButtonBar\\"><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomStatusBar_unsentRetry\\">Retry</div></div></div></div></main></div>"`;
exports[`RoomView for a local room in state ERROR should match the snapshot 1`] = `"<div class="mx_RoomView mx_RoomView--local"><header class="mx_RoomHeader light-panel"><div class="mx_RoomHeader_wrapper"><div class="mx_RoomHeader_avatar"><div class="mx_DecoratedRoomAvatar"><span class="mx_BaseAvatar" role="presentation"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 15.600000000000001px; width: 24px; line-height: 24px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 24px; height: 24px;" aria-hidden="true"></span></div></div><div class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"></div><div class="mx_RoomHeader_name mx_RoomHeader_name--textonly"><div dir="auto" class="mx_RoomHeader_nametext" title="@user:example.com" role="heading" aria-level="1">@user:example.com</div></div><div class="mx_RoomHeader_topic mx_RoomTopic" dir="auto"><div tabindex="0"><div><span dir="auto"></span></div></div></div></div></header><main class="mx_RoomView_body"><div class="mx_RoomView_timeline"><div class="mx_AutoHideScrollbar mx_ScrollPanel mx_RoomView_messagePanel" tabindex="-1"><div class="mx_RoomView_messageListWrapper"><ol class="mx_RoomView_MessageList" aria-live="polite" style="height: 400px;"><li class="mx_NewRoomIntro"><div class="mx_EventTileBubble mx_cryptoEvent mx_cryptoEvent_icon_warning"><div class="mx_EventTileBubble_title">End-to-end encryption isn't enabled</div><div class="mx_EventTileBubble_subtitle"><span> Your private messages are normally encrypted, but this room isn't. Usually this is due to an unsupported device or method being used, like email invites. </span></div></div><span aria-label="Avatar" aria-live="off" role="button" tabindex="0" class="mx_AccessibleButton mx_BaseAvatar"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 33.800000000000004px; width: 52px; line-height: 52px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 52px; height: 52px;" aria-hidden="true"></span><h2>@user:example.com</h2><p><span>Send your first message to invite <b>@user:example.com</b> to chat</span></p></li></ol></div></div></div><div class="mx_RoomStatusBar mx_RoomStatusBar_unsentMessages"><div role="alert"><div class="mx_RoomStatusBar_unsentBadge"><div class="mx_NotificationBadge mx_NotificationBadge_visible mx_NotificationBadge_highlighted mx_NotificationBadge_2char"><span class="mx_NotificationBadge_count">!</span></div></div><div><div class="mx_RoomStatusBar_unsentTitle">Some of your messages have not been sent</div></div><div class="mx_RoomStatusBar_unsentButtonBar"><div role="button" tabindex="0" class="mx_AccessibleButton mx_RoomStatusBar_unsentRetry">Retry</div></div></div></div></main></div>"`;
exports[`RoomView for a local room in state NEW should match the snapshot 1`] = `"<div class=\\"mx_RoomView mx_RoomView--local\\"><header class=\\"mx_RoomHeader light-panel\\"><div class=\\"mx_RoomHeader_wrapper\\"><div class=\\"mx_RoomHeader_avatar\\"><div class=\\"mx_DecoratedRoomAvatar\\"><span class=\\"mx_BaseAvatar\\" role=\\"presentation\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 15.600000000000001px; width: 24px; line-height: 24px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 24px; height: 24px;\\" aria-hidden=\\"true\\"></span></div></div><div class=\\"mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon\\"></div><div class=\\"mx_RoomHeader_name mx_RoomHeader_name--textonly\\"><div dir=\\"auto\\" class=\\"mx_RoomHeader_nametext\\" title=\\"@user:example.com\\" role=\\"heading\\" aria-level=\\"1\\">@user:example.com</div></div><div class=\\"mx_RoomHeader_topic mx_RoomTopic\\" dir=\\"auto\\"><div tabindex=\\"0\\"><div><span dir=\\"auto\\"></span></div></div></div></div></header><main class=\\"mx_RoomView_body\\"><div class=\\"mx_RoomView_timeline\\"><div class=\\"mx_AutoHideScrollbar mx_ScrollPanel mx_RoomView_messagePanel\\" tabindex=\\"-1\\"><div class=\\"mx_RoomView_messageListWrapper\\"><ol class=\\"mx_RoomView_MessageList\\" aria-live=\\"polite\\" style=\\"height: 400px;\\"><li class=\\"mx_NewRoomIntro\\"><div class=\\"mx_EventTileBubble mx_cryptoEvent mx_cryptoEvent_icon_warning\\"><div class=\\"mx_EventTileBubble_title\\">End-to-end encryption isn't enabled</div><div class=\\"mx_EventTileBubble_subtitle\\"><span> Your private messages are normally encrypted, but this room isn't. Usually this is due to an unsupported device or method being used, like email invites. </span></div></div><span aria-label=\\"Avatar\\" aria-live=\\"off\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_BaseAvatar\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 33.800000000000004px; width: 52px; line-height: 52px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 52px; height: 52px;\\" aria-hidden=\\"true\\"></span><h2>@user:example.com</h2><p><span>Send your first message to invite <b>@user:example.com</b> to chat</span></p></li></ol></div></div></div><div class=\\"mx_MessageComposer\\"><div class=\\"mx_MessageComposer_wrapper\\"><div class=\\"mx_MessageComposer_row\\"><div class=\\"mx_SendMessageComposer\\"><div class=\\"mx_BasicMessageComposer\\"><div class=\\"mx_MessageComposerFormatBar\\"><button type=\\"button\\" aria-label=\\"Bold\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconBold\\"></button><button type=\\"button\\" aria-label=\\"Italics\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconItalic\\"></button><button type=\\"button\\" aria-label=\\"Strikethrough\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconStrikethrough\\"></button><button type=\\"button\\" aria-label=\\"Code block\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconCode\\"></button><button type=\\"button\\" aria-label=\\"Quote\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconQuote\\"></button><button type=\\"button\\" aria-label=\\"Insert link\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconInsertLink\\"></button></div><div class=\\"mx_BasicMessageComposer_input mx_BasicMessageComposer_input_shouldShowPillAvatar mx_BasicMessageComposer_inputEmpty\\" contenteditable=\\"true\\" tabindex=\\"0\\" aria-label=\\"Send a message…\\" role=\\"textbox\\" aria-multiline=\\"true\\" aria-autocomplete=\\"list\\" aria-haspopup=\\"listbox\\" dir=\\"auto\\" aria-disabled=\\"false\\" data-testid=\\"basicmessagecomposer\\" style=\\"--placeholder: 'Send a message…';\\"><div><br></div></div></div></div><div aria-label=\\"Emoji\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_emoji\\"></div><div aria-label=\\"Attachment\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_upload\\"></div><div aria-label=\\"More options\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_buttonMenu\\"></div><input type=\\"file\\" style=\\"display: none;\\" multiple=\\"\\"></div></div></div></main></div>"`;
exports[`RoomView for a local room in state NEW should match the snapshot 1`] = `"<div class="mx_RoomView mx_RoomView--local"><header class="mx_RoomHeader light-panel"><div class="mx_RoomHeader_wrapper"><div class="mx_RoomHeader_avatar"><div class="mx_DecoratedRoomAvatar"><span class="mx_BaseAvatar" role="presentation"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 15.600000000000001px; width: 24px; line-height: 24px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 24px; height: 24px;" aria-hidden="true"></span></div></div><div class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"></div><div class="mx_RoomHeader_name mx_RoomHeader_name--textonly"><div dir="auto" class="mx_RoomHeader_nametext" title="@user:example.com" role="heading" aria-level="1">@user:example.com</div></div><div class="mx_RoomHeader_topic mx_RoomTopic" dir="auto"><div tabindex="0"><div><span dir="auto"></span></div></div></div></div></header><main class="mx_RoomView_body"><div class="mx_RoomView_timeline"><div class="mx_AutoHideScrollbar mx_ScrollPanel mx_RoomView_messagePanel" tabindex="-1"><div class="mx_RoomView_messageListWrapper"><ol class="mx_RoomView_MessageList" aria-live="polite" style="height: 400px;"><li class="mx_NewRoomIntro"><div class="mx_EventTileBubble mx_cryptoEvent mx_cryptoEvent_icon_warning"><div class="mx_EventTileBubble_title">End-to-end encryption isn't enabled</div><div class="mx_EventTileBubble_subtitle"><span> Your private messages are normally encrypted, but this room isn't. Usually this is due to an unsupported device or method being used, like email invites. </span></div></div><span aria-label="Avatar" aria-live="off" role="button" tabindex="0" class="mx_AccessibleButton mx_BaseAvatar"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 33.800000000000004px; width: 52px; line-height: 52px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 52px; height: 52px;" aria-hidden="true"></span><h2>@user:example.com</h2><p><span>Send your first message to invite <b>@user:example.com</b> to chat</span></p></li></ol></div></div></div><div class="mx_MessageComposer"><div class="mx_MessageComposer_wrapper"><div class="mx_MessageComposer_row"><div class="mx_SendMessageComposer"><div class="mx_BasicMessageComposer"><div class="mx_MessageComposerFormatBar"><button type="button" aria-label="Bold" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconBold"></button><button type="button" aria-label="Italics" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconItalic"></button><button type="button" aria-label="Strikethrough" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconStrikethrough"></button><button type="button" aria-label="Code block" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconCode"></button><button type="button" aria-label="Quote" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconQuote"></button><button type="button" aria-label="Insert link" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconInsertLink"></button></div><div class="mx_BasicMessageComposer_input mx_BasicMessageComposer_input_shouldShowPillAvatar mx_BasicMessageComposer_inputEmpty" contenteditable="true" tabindex="0" aria-label="Send a message…" role="textbox" aria-multiline="true" aria-autocomplete="list" aria-haspopup="listbox" dir="auto" aria-disabled="false" data-testid="basicmessagecomposer" style="--placeholder: 'Send a message…';"><div><br></div></div></div></div><div aria-label="Emoji" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_emoji"></div><div aria-label="Attachment" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_upload"></div><div aria-label="More options" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_buttonMenu"></div><input type="file" style="display: none;" multiple=""></div></div></div></main></div>"`;
exports[`RoomView for a local room in state NEW that is encrypted should match the snapshot 1`] = `"<div class=\\"mx_RoomView mx_RoomView--local\\"><header class=\\"mx_RoomHeader light-panel\\"><div class=\\"mx_RoomHeader_wrapper\\"><div class=\\"mx_RoomHeader_avatar\\"><div class=\\"mx_DecoratedRoomAvatar\\"><span class=\\"mx_BaseAvatar\\" role=\\"presentation\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 15.600000000000001px; width: 24px; line-height: 24px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 24px; height: 24px;\\" aria-hidden=\\"true\\"></span></div></div><div class=\\"mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon\\"></div><div class=\\"mx_RoomHeader_name mx_RoomHeader_name--textonly\\"><div dir=\\"auto\\" class=\\"mx_RoomHeader_nametext\\" title=\\"@user:example.com\\" role=\\"heading\\" aria-level=\\"1\\">@user:example.com</div></div><div class=\\"mx_RoomHeader_topic mx_RoomTopic\\" dir=\\"auto\\"><div tabindex=\\"0\\"><div><span dir=\\"auto\\"></span></div></div></div></div></header><main class=\\"mx_RoomView_body\\"><div class=\\"mx_RoomView_timeline\\"><div class=\\"mx_AutoHideScrollbar mx_ScrollPanel mx_RoomView_messagePanel\\" tabindex=\\"-1\\"><div class=\\"mx_RoomView_messageListWrapper\\"><ol class=\\"mx_RoomView_MessageList\\" aria-live=\\"polite\\" style=\\"height: 400px;\\"><div class=\\"mx_EventTileBubble mx_cryptoEvent mx_cryptoEvent_icon\\"><div class=\\"mx_EventTileBubble_title\\">Encryption enabled</div><div class=\\"mx_EventTileBubble_subtitle\\">Messages in this chat will be end-to-end encrypted.</div></div><li class=\\"mx_NewRoomIntro\\"><span aria-label=\\"Avatar\\" aria-live=\\"off\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_BaseAvatar\\"><span class=\\"mx_BaseAvatar_initial\\" aria-hidden=\\"true\\" style=\\"font-size: 33.800000000000004px; width: 52px; line-height: 52px;\\">U</span><img class=\\"mx_BaseAvatar_image\\" src=\\"data:image/png;base64,00\\" alt=\\"\\" style=\\"width: 52px; height: 52px;\\" aria-hidden=\\"true\\"></span><h2>@user:example.com</h2><p><span>Send your first message to invite <b>@user:example.com</b> to chat</span></p></li></ol></div></div></div><div class=\\"mx_MessageComposer\\"><div class=\\"mx_MessageComposer_wrapper\\"><div class=\\"mx_MessageComposer_row\\"><div class=\\"mx_SendMessageComposer\\"><div class=\\"mx_BasicMessageComposer\\"><div class=\\"mx_MessageComposerFormatBar\\"><button type=\\"button\\" aria-label=\\"Bold\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconBold\\"></button><button type=\\"button\\" aria-label=\\"Italics\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconItalic\\"></button><button type=\\"button\\" aria-label=\\"Strikethrough\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconStrikethrough\\"></button><button type=\\"button\\" aria-label=\\"Code block\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconCode\\"></button><button type=\\"button\\" aria-label=\\"Quote\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconQuote\\"></button><button type=\\"button\\" aria-label=\\"Insert link\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconInsertLink\\"></button></div><div class=\\"mx_BasicMessageComposer_input mx_BasicMessageComposer_input_shouldShowPillAvatar mx_BasicMessageComposer_inputEmpty\\" contenteditable=\\"true\\" tabindex=\\"0\\" aria-label=\\"Send a message…\\" role=\\"textbox\\" aria-multiline=\\"true\\" aria-autocomplete=\\"list\\" aria-haspopup=\\"listbox\\" dir=\\"auto\\" aria-disabled=\\"false\\" data-testid=\\"basicmessagecomposer\\" style=\\"--placeholder: 'Send a message…';\\"><div><br></div></div></div></div><div aria-label=\\"Emoji\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_emoji\\"></div><div aria-label=\\"Attachment\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_upload\\"></div><div aria-label=\\"More options\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_buttonMenu\\"></div><input type=\\"file\\" style=\\"display: none;\\" multiple=\\"\\"></div></div></div></main></div>"`;
exports[`RoomView for a local room in state NEW that is encrypted should match the snapshot 1`] = `"<div class="mx_RoomView mx_RoomView--local"><header class="mx_RoomHeader light-panel"><div class="mx_RoomHeader_wrapper"><div class="mx_RoomHeader_avatar"><div class="mx_DecoratedRoomAvatar"><span class="mx_BaseAvatar" role="presentation"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 15.600000000000001px; width: 24px; line-height: 24px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 24px; height: 24px;" aria-hidden="true"></span></div></div><div class="mx_E2EIcon mx_E2EIcon_normal mx_RoomHeader_icon"></div><div class="mx_RoomHeader_name mx_RoomHeader_name--textonly"><div dir="auto" class="mx_RoomHeader_nametext" title="@user:example.com" role="heading" aria-level="1">@user:example.com</div></div><div class="mx_RoomHeader_topic mx_RoomTopic" dir="auto"><div tabindex="0"><div><span dir="auto"></span></div></div></div></div></header><main class="mx_RoomView_body"><div class="mx_RoomView_timeline"><div class="mx_AutoHideScrollbar mx_ScrollPanel mx_RoomView_messagePanel" tabindex="-1"><div class="mx_RoomView_messageListWrapper"><ol class="mx_RoomView_MessageList" aria-live="polite" style="height: 400px;"><div class="mx_EventTileBubble mx_cryptoEvent mx_cryptoEvent_icon"><div class="mx_EventTileBubble_title">Encryption enabled</div><div class="mx_EventTileBubble_subtitle">Messages in this chat will be end-to-end encrypted.</div></div><li class="mx_NewRoomIntro"><span aria-label="Avatar" aria-live="off" role="button" tabindex="0" class="mx_AccessibleButton mx_BaseAvatar"><span class="mx_BaseAvatar_initial" aria-hidden="true" style="font-size: 33.800000000000004px; width: 52px; line-height: 52px;">U</span><img class="mx_BaseAvatar_image" src="data:image/png;base64,00" alt="" style="width: 52px; height: 52px;" aria-hidden="true"></span><h2>@user:example.com</h2><p><span>Send your first message to invite <b>@user:example.com</b> to chat</span></p></li></ol></div></div></div><div class="mx_MessageComposer"><div class="mx_MessageComposer_wrapper"><div class="mx_MessageComposer_row"><div class="mx_SendMessageComposer"><div class="mx_BasicMessageComposer"><div class="mx_MessageComposerFormatBar"><button type="button" aria-label="Bold" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconBold"></button><button type="button" aria-label="Italics" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconItalic"></button><button type="button" aria-label="Strikethrough" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconStrikethrough"></button><button type="button" aria-label="Code block" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconCode"></button><button type="button" aria-label="Quote" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconQuote"></button><button type="button" aria-label="Insert link" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposerFormatBar_button mx_MessageComposerFormatBar_buttonIconInsertLink"></button></div><div class="mx_BasicMessageComposer_input mx_BasicMessageComposer_input_shouldShowPillAvatar mx_BasicMessageComposer_inputEmpty" contenteditable="true" tabindex="0" aria-label="Send a message…" role="textbox" aria-multiline="true" aria-autocomplete="list" aria-haspopup="listbox" dir="auto" aria-disabled="false" data-testid="basicmessagecomposer" style="--placeholder: 'Send a message…';"><div><br></div></div></div></div><div aria-label="Emoji" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_emoji"></div><div aria-label="Attachment" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_upload"></div><div aria-label="More options" role="button" tabindex="0" class="mx_AccessibleButton mx_MessageComposer_button mx_MessageComposer_buttonMenu"></div><input type="file" style="display: none;" multiple=""></div></div></div></main></div>"`;

View file

@ -97,6 +97,7 @@ describe('<LeftPanelLiveShareWarning />', () => {
});
beforeEach(() => {
// @ts-ignore writing to readonly variable
mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = true;
mocked(OwnBeaconStore.instance).getLiveBeaconIdsWithLocationPublishError.mockReturnValue([]);
mocked(OwnBeaconStore.instance).getLiveBeaconIds.mockReturnValue([beacon2.identifier, beacon1.identifier]);
@ -190,6 +191,7 @@ describe('<LeftPanelLiveShareWarning />', () => {
expect(container.innerHTML).toBeTruthy();
act(() => {
// @ts-ignore writing to readonly variable
mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = false;
OwnBeaconStore.instance.emit(OwnBeaconStoreEvent.MonitoringLivePosition);
});

View file

@ -4,19 +4,19 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
<BeaconMarker
beacon={
Beacon {
"_beaconInfo": Object {
"_beaconInfo": {
"assetType": "m.self",
"description": undefined,
"live": true,
"timeout": 3600000,
"timestamp": 1647270879403,
},
"_events": Object {
"Beacon.Destroy": Array [
"_events": {
"Beacon.Destroy": [
[Function],
[Function],
],
"Beacon.LivenessChange": Array [
"Beacon.LivenessChange": [
[Function],
[Function],
],
@ -26,13 +26,13 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
},
"_eventsCount": 5,
"_isLive": true,
"_latestLocationEvent": Object {
"content": Object {
"m.relates_to": Object {
"_latestLocationEvent": {
"content": {
"m.relates_to": {
"event_id": "$alice-room1-1",
"rel_type": "m.reference",
},
"org.matrix.msc3488.location": Object {
"org.matrix.msc3488.location": {
"description": undefined,
"uri": "geo:51,41",
},
@ -46,11 +46,11 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
"clearLatestLocation": [Function],
"livenessWatchTimeout": undefined,
"roomId": "!room:server",
"rootEvent": Object {
"content": Object {
"rootEvent": {
"content": {
"description": undefined,
"live": true,
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.self",
},
"org.matrix.msc3488.ts": 1647270879403,
@ -68,7 +68,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
}
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],
@ -87,7 +87,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
id="!room:server_@alice:server"
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],
@ -102,12 +102,12 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
}
roomMember={
RoomMember {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isOutOfBand": false,
"_maxListeners": undefined,
"disambiguate": false,
"events": Object {},
"events": {},
"membership": undefined,
"modified": 1647270879403,
"name": "@alice:server",
@ -129,12 +129,12 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
id="!room:server_@alice:server"
roomMember={
RoomMember {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isOutOfBand": false,
"_maxListeners": undefined,
"disambiguate": false,
"events": Object {},
"events": {},
"membership": undefined,
"modified": 1647270879403,
"name": "@alice:server",
@ -164,12 +164,12 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
hideTitle={false}
member={
RoomMember {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isOutOfBand": false,
"_maxListeners": undefined,
"disambiguate": false,
"events": Object {},
"events": {},
"membership": undefined,
"modified": 1647270879403,
"name": "@alice:server",
@ -205,7 +205,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
aria-hidden="true"
className="mx_BaseAvatar_initial"
style={
Object {
{
"fontSize": "23.400000000000002px",
"lineHeight": "36px",
"width": "36px",
@ -221,7 +221,7 @@ exports[`<BeaconMarker /> renders marker when beacon has location 1`] = `
onError={[Function]}
src="data:image/png;base64,00"
style={
Object {
{
"height": "36px",
"width": "36px",
}

View file

@ -6,14 +6,14 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
<BeaconStatus
beacon={
Beacon {
"_beaconInfo": Object {
"_beaconInfo": {
"assetType": "m.self",
"description": undefined,
"live": false,
"timeout": 3600000,
"timestamp": 123456789,
},
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isLive": false,
"_latestLocationEvent": undefined,
@ -21,11 +21,11 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
"clearLatestLocation": [Function],
"livenessWatchTimeout": undefined,
"roomId": "!room:server",
"rootEvent": Object {
"content": Object {
"rootEvent": {
"content": {
"description": undefined,
"live": false,
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.self",
},
"org.matrix.msc3488.ts": 123456789,
@ -68,14 +68,14 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
<BeaconExpiryTime
beacon={
Beacon {
"_beaconInfo": Object {
"_beaconInfo": {
"assetType": "m.self",
"description": undefined,
"live": false,
"timeout": 3600000,
"timestamp": 123456789,
},
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_isLive": false,
"_latestLocationEvent": undefined,
@ -83,11 +83,11 @@ exports[`<BeaconStatus /> active state renders without children 1`] = `
"clearLatestLocation": [Function],
"livenessWatchTimeout": undefined,
"roomId": "!room:server",
"rootEvent": Object {
"content": Object {
"rootEvent": {
"content": {
"description": undefined,
"live": false,
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.self",
},
"org.matrix.msc3488.ts": 123456789,

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<BeaconViewDialog /> renders a fallback when there are no locations 1`] = `
Array [
[
<MapFallback
className="mx_BeaconViewDialog_map"
data-test-id="beacon-view-dialog-map-fallback"

View file

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with one live beacon in room 1`] = `"<div class=\\"mx_RoomLiveShareWarning\\"><div class=\\"mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon\\"></div><span class=\\"mx_RoomLiveShareWarning_label\\">You are sharing your live location</span><span data-test-id=\\"room-live-share-expiry\\" class=\\"mx_LiveTimeRemaining\\">1h left</span><button data-test-id=\\"room-live-share-primary-button\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with one live beacon in room 1`] = `"<div class="mx_RoomLiveShareWarning"><div class="mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon"></div><span class="mx_RoomLiveShareWarning_label">You are sharing your live location</span><span data-test-id="room-live-share-expiry" class="mx_LiveTimeRemaining">1h left</span><button data-test-id="room-live-share-primary-button" role="button" tabindex="0" class="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with two live beacons in room 1`] = `"<div class=\\"mx_RoomLiveShareWarning\\"><div class=\\"mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon\\"></div><span class=\\"mx_RoomLiveShareWarning_label\\">You are sharing your live location</span><span data-test-id=\\"room-live-share-expiry\\" class=\\"mx_LiveTimeRemaining\\">12h left</span><button data-test-id=\\"room-live-share-primary-button\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available renders correctly with two live beacons in room 1`] = `"<div class="mx_RoomLiveShareWarning"><div class="mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon"></div><span class="mx_RoomLiveShareWarning_label">You are sharing your live location</span><span data-test-id="room-live-share-expiry" class="mx_LiveTimeRemaining">12h left</span><button data-test-id="room-live-share-primary-button" role="button" tabindex="0" class="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger">Stop</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available stopping beacons displays error when stop sharing fails 1`] = `"<div class=\\"mx_RoomLiveShareWarning\\"><div class=\\"mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon mx_StyledLiveBeaconIcon_error\\"></div><span class=\\"mx_RoomLiveShareWarning_label\\">An error occurred while stopping your live location, please try again</span><button data-test-id=\\"room-live-share-primary-button\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Retry</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available stopping beacons displays error when stop sharing fails 1`] = `"<div class="mx_RoomLiveShareWarning"><div class="mx_StyledLiveBeaconIcon mx_RoomLiveShareWarning_icon mx_StyledLiveBeaconIcon_error"></div><span class="mx_RoomLiveShareWarning_label">An error occurred while stopping your live location, please try again</span><button data-test-id="room-live-share-primary-button" role="button" tabindex="0" class="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger">Retry</button></div>"`;
exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is available with location publish errors displays location publish error when mounted with location publish errors 1`] = `
<RoomLiveShareWarning
@ -12,7 +12,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
>
<RoomLiveShareWarningInner
liveBeaconIds={
Array [
[
"$room2:server.org_@alice:server.org",
]
}

View file

@ -4,43 +4,43 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
<SpaceContextMenu
onFinished={[MockFunction]}
space={
Object {
{
"canInvite": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
"@test:server",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
],
},
"client": Object {
"client": {
"getUserId": [MockFunction] {
"calls": Array [
Array [],
"calls": [
[],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": "@test:server",
},
],
},
},
"currentState": Object {
"currentState": {
"maySendStateEvent": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
"m.space.child",
"@test:server",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -48,11 +48,11 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
},
},
"getJoinRule": [MockFunction] {
"calls": Array [
Array [],
"calls": [
[],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -180,7 +180,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
onContextMenu={[Function]}
onKeyDown={[Function]}
style={
Object {
{
"bottom": undefined,
"right": undefined,
}
@ -190,12 +190,12 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_ContextualMenu_background"
onClick={[Function]}
onContextMenu={[Function]}
style={Object {}}
style={{}}
/>
<div
className="mx_ContextualMenu"
role="menu"
style={Object {}}
style={{}}
>
<div
className="mx_IconizedContextMenu mx_SpacePanel_contextMenu mx_IconizedContextMenu_compact"
@ -232,7 +232,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_IconizedContextMenu_item"
element="div"
inputRef={
Object {
{
"current": <div
aria-label="Space home"
class="mx_AccessibleButton mx_IconizedContextMenu_item focus-visible"
@ -300,7 +300,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_IconizedContextMenu_item"
element="div"
inputRef={
Object {
{
"current": <div
aria-label="Explore rooms"
class="mx_AccessibleButton mx_IconizedContextMenu_item"
@ -367,7 +367,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_IconizedContextMenu_item"
element="div"
inputRef={
Object {
{
"current": <div
aria-label="Preferences"
class="mx_AccessibleButton mx_IconizedContextMenu_item"
@ -439,7 +439,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
data-test-id="leave-option"
element="div"
inputRef={
Object {
{
"current": <div
aria-label="Leave space"
class="mx_AccessibleButton mx_IconizedContextMenu_option_red mx_IconizedContextMenu_item"

View file

@ -133,7 +133,7 @@ describe("ForwardDialog", () => {
// Make sendEvent require manual resolution so we can see the sending state
let finishSend;
let cancelSend;
mockClient.sendEvent.mockImplementation(() => new Promise((resolve, reject) => {
mockClient.sendEvent.mockImplementation(<T extends {}>() => new Promise<T>((resolve, reject) => {
finishSend = resolve;
cancelSend = reject;
}));

View file

@ -104,24 +104,27 @@ describe('<UserSettingsDialog />', () => {
});
it('renders ignored users tab when feature_mjolnir is enabled', () => {
mockSettingsStore.getValue.mockImplementation((settingName) => settingName === "feature_mjolnir");
mockSettingsStore.getValue.mockImplementation((settingName): any => settingName === "feature_mjolnir");
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Mjolnir}`)).toBeTruthy();
});
it('renders voip tab when voip is enabled', () => {
mockSettingsStore.getValue.mockImplementation((settingName) => settingName === UIFeature.Voip);
mockSettingsStore.getValue.mockImplementation((settingName): any => settingName === UIFeature.Voip);
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Voice}`)).toBeTruthy();
});
it('renders session manager tab when enabled', () => {
mockSettingsStore.getValue.mockImplementation((settingName) => settingName === "feature_new_device_manager");
mockSettingsStore.getValue.mockImplementation((settingName): any => {
return settingName === "feature_new_device_manager";
});
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.SessionManager}`)).toBeTruthy();
});
it('renders labs tab when show_labs_settings is enabled in config', () => {
// @ts-ignore simplified test stub
mockSdkConfig.get.mockImplementation((configName) => configName === "show_labs_settings");
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Labs}`)).toBeTruthy();

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<ExportDialog /> renders export dialog 1`] = `
Array [
[
<BaseDialog
className="mx_ExportDialog false"
contentId="mx_Dialog_content"
@ -14,7 +14,7 @@ Array [
<ForwardRef(FocusLockUICombination)
className="mx_ExportDialog false mx_Dialog_fixedWidth"
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -30,7 +30,7 @@ Array [
crossFrame={true}
disabled={false}
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -46,7 +46,7 @@ Array [
data-focus-guard={true}
key="guard-first"
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -62,7 +62,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -269,12 +269,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -287,7 +287,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -494,12 +494,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -566,16 +566,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},
@ -849,7 +849,7 @@ Array [
<div
data-focus-guard={true}
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -867,7 +867,7 @@ Array [
<ForwardRef(FocusLockUICombination)
className="mx_ExportDialog false mx_Dialog_fixedWidth"
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -883,7 +883,7 @@ Array [
crossFrame={true}
disabled={false}
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -899,7 +899,7 @@ Array [
data-focus-guard={true}
key="guard-first"
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -915,7 +915,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -1122,12 +1122,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -1140,7 +1140,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -1347,12 +1347,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -1419,16 +1419,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},
@ -1702,7 +1702,7 @@ Array [
<div
data-focus-guard={true}
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -1723,7 +1723,7 @@ Array [
crossFrame={true}
disabled={false}
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -1739,7 +1739,7 @@ Array [
data-focus-guard={true}
key="guard-first"
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -1755,7 +1755,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -1962,12 +1962,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -1980,7 +1980,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -2187,12 +2187,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -2259,16 +2259,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},
@ -2542,7 +2542,7 @@ Array [
<div
data-focus-guard={true}
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -2612,16 +2612,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PollCreateDialog renders a blank poll 1`] = `"<div data-focus-guard=\\"true\\" tabindex=\\"0\\" style=\\"width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;\\"></div><div data-focus-lock-disabled=\\"false\\" role=\\"dialog\\" aria-labelledby=\\"mx_CompoundDialog_title\\" aria-describedby=\\"mx_CompoundDialog_content\\" class=\\"mx_CompoundDialog mx_ScrollableBaseDialog\\"><div class=\\"mx_CompoundDialog_header\\"><h1>Create poll</h1><div aria-label=\\"Close dialog\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_CompoundDialog_cancelButton\\"></div></div><form><div class=\\"mx_CompoundDialog_content\\"><div class=\\"mx_PollCreateDialog\\"><h2>Poll type</h2><div class=\\"mx_Field mx_Field_select\\"><select type=\\"text\\" id=\\"mx_Field_1\\"><option value=\\"org.matrix.msc3381.poll.disclosed\\">Open poll</option><option value=\\"org.matrix.msc3381.poll.undisclosed\\">Closed poll</option></select><label for=\\"mx_Field_1\\"></label></div><p>Voters see results as soon as they have voted</p><h2>What is your poll question or topic?</h2><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"poll-topic-input\\" maxlength=\\"340\\" label=\\"Question or topic\\" placeholder=\\"Write something...\\" type=\\"text\\" value=\\"\\"><label for=\\"poll-topic-input\\">Question or topic</label></div><h2>Create options</h2><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_0\\" maxlength=\\"340\\" label=\\"Option 1\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"\\"><label for=\\"pollcreate_option_0\\">Option 1</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_1\\" maxlength=\\"340\\" label=\\"Option 2\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"\\"><label for=\\"pollcreate_option_1\\">Option 2</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_addOption mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary\\">Add option</div></div></div><div class=\\"mx_CompoundDialog_footer\\"><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline\\">Cancel</div><button type=\\"submit\\" role=\\"button\\" tabindex=\\"0\\" aria-disabled=\\"true\\" disabled=\\"\\" class=\\"mx_AccessibleButton mx_Dialog_nonDialogButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary mx_AccessibleButton_disabled\\">Create Poll</button></div></form></div><div data-focus-guard=\\"true\\" tabindex=\\"0\\" style=\\"width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;\\"></div>"`;
exports[`PollCreateDialog renders a blank poll 1`] = `"<div data-focus-guard="true" tabindex="0" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"></div><div data-focus-lock-disabled="false" role="dialog" aria-labelledby="mx_CompoundDialog_title" aria-describedby="mx_CompoundDialog_content" class="mx_CompoundDialog mx_ScrollableBaseDialog"><div class="mx_CompoundDialog_header"><h1>Create poll</h1><div aria-label="Close dialog" role="button" tabindex="0" class="mx_AccessibleButton mx_CompoundDialog_cancelButton"></div></div><form><div class="mx_CompoundDialog_content"><div class="mx_PollCreateDialog"><h2>Poll type</h2><div class="mx_Field mx_Field_select"><select type="text" id="mx_Field_1"><option value="org.matrix.msc3381.poll.disclosed">Open poll</option><option value="org.matrix.msc3381.poll.undisclosed">Closed poll</option></select><label for="mx_Field_1"></label></div><p>Voters see results as soon as they have voted</p><h2>What is your poll question or topic?</h2><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="poll-topic-input" maxlength="340" label="Question or topic" placeholder="Write something..." type="text" value=""><label for="poll-topic-input">Question or topic</label></div><h2>Create options</h2><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_0" maxlength="340" label="Option 1" placeholder="Write an option" type="text" value=""><label for="pollcreate_option_0">Option 1</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_1" maxlength="340" label="Option 2" placeholder="Write an option" type="text" value=""><label for="pollcreate_option_1">Option 2</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_addOption mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary">Add option</div></div></div><div class="mx_CompoundDialog_footer"><div role="button" tabindex="0" class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline">Cancel</div><button type="submit" role="button" tabindex="0" aria-disabled="true" disabled="" class="mx_AccessibleButton mx_Dialog_nonDialogButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary mx_AccessibleButton_disabled">Create Poll</button></div></form></div><div data-focus-guard="true" tabindex="0" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"></div>"`;
exports[`PollCreateDialog renders a question and some options 1`] = `"<div data-focus-guard=\\"true\\" tabindex=\\"0\\" style=\\"width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;\\"></div><div data-focus-lock-disabled=\\"false\\" role=\\"dialog\\" aria-labelledby=\\"mx_CompoundDialog_title\\" aria-describedby=\\"mx_CompoundDialog_content\\" class=\\"mx_CompoundDialog mx_ScrollableBaseDialog\\"><div class=\\"mx_CompoundDialog_header\\"><h1>Create poll</h1><div aria-label=\\"Close dialog\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_CompoundDialog_cancelButton\\"></div></div><form><div class=\\"mx_CompoundDialog_content\\"><div class=\\"mx_PollCreateDialog\\"><h2>Poll type</h2><div class=\\"mx_Field mx_Field_select\\"><select type=\\"text\\" id=\\"mx_Field_4\\"><option value=\\"org.matrix.msc3381.poll.disclosed\\">Open poll</option><option value=\\"org.matrix.msc3381.poll.undisclosed\\">Closed poll</option></select><label for=\\"mx_Field_4\\"></label></div><p>Voters see results as soon as they have voted</p><h2>What is your poll question or topic?</h2><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"poll-topic-input\\" maxlength=\\"340\\" label=\\"Question or topic\\" placeholder=\\"Write something...\\" type=\\"text\\" value=\\"How many turnips is the optimal number?\\"><label for=\\"poll-topic-input\\">Question or topic</label></div><h2>Create options</h2><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_0\\" maxlength=\\"340\\" label=\\"Option 1\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"As many as my neighbour\\"><label for=\\"pollcreate_option_0\\">Option 1</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_1\\" maxlength=\\"340\\" label=\\"Option 2\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"The question is meaningless\\"><label for=\\"pollcreate_option_1\\">Option 2</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_2\\" maxlength=\\"340\\" label=\\"Option 3\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"Mu\\"><label for=\\"pollcreate_option_2\\">Option 3</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_addOption mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary\\">Add option</div></div></div><div class=\\"mx_CompoundDialog_footer\\"><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline\\">Cancel</div><button type=\\"submit\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_Dialog_nonDialogButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary\\">Create Poll</button></div></form></div><div data-focus-guard=\\"true\\" tabindex=\\"0\\" style=\\"width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;\\"></div>"`;
exports[`PollCreateDialog renders a question and some options 1`] = `"<div data-focus-guard="true" tabindex="0" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"></div><div data-focus-lock-disabled="false" role="dialog" aria-labelledby="mx_CompoundDialog_title" aria-describedby="mx_CompoundDialog_content" class="mx_CompoundDialog mx_ScrollableBaseDialog"><div class="mx_CompoundDialog_header"><h1>Create poll</h1><div aria-label="Close dialog" role="button" tabindex="0" class="mx_AccessibleButton mx_CompoundDialog_cancelButton"></div></div><form><div class="mx_CompoundDialog_content"><div class="mx_PollCreateDialog"><h2>Poll type</h2><div class="mx_Field mx_Field_select"><select type="text" id="mx_Field_4"><option value="org.matrix.msc3381.poll.disclosed">Open poll</option><option value="org.matrix.msc3381.poll.undisclosed">Closed poll</option></select><label for="mx_Field_4"></label></div><p>Voters see results as soon as they have voted</p><h2>What is your poll question or topic?</h2><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="poll-topic-input" maxlength="340" label="Question or topic" placeholder="Write something..." type="text" value="How many turnips is the optimal number?"><label for="poll-topic-input">Question or topic</label></div><h2>Create options</h2><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_0" maxlength="340" label="Option 1" placeholder="Write an option" type="text" value="As many as my neighbour"><label for="pollcreate_option_0">Option 1</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_1" maxlength="340" label="Option 2" placeholder="Write an option" type="text" value="The question is meaningless"><label for="pollcreate_option_1">Option 2</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_2" maxlength="340" label="Option 3" placeholder="Write an option" type="text" value="Mu"><label for="pollcreate_option_2">Option 3</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_addOption mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary">Add option</div></div></div><div class="mx_CompoundDialog_footer"><div role="button" tabindex="0" class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline">Cancel</div><button type="submit" role="button" tabindex="0" class="mx_AccessibleButton mx_Dialog_nonDialogButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary">Create Poll</button></div></form></div><div data-focus-guard="true" tabindex="0" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"></div>"`;
exports[`PollCreateDialog renders info from a previous event 1`] = `"<div data-focus-guard=\\"true\\" tabindex=\\"0\\" style=\\"width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;\\"></div><div data-focus-lock-disabled=\\"false\\" role=\\"dialog\\" aria-labelledby=\\"mx_CompoundDialog_title\\" aria-describedby=\\"mx_CompoundDialog_content\\" class=\\"mx_CompoundDialog mx_ScrollableBaseDialog\\"><div class=\\"mx_CompoundDialog_header\\"><h1>Edit poll</h1><div aria-label=\\"Close dialog\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_CompoundDialog_cancelButton\\"></div></div><form><div class=\\"mx_CompoundDialog_content\\"><div class=\\"mx_PollCreateDialog\\"><h2>Poll type</h2><div class=\\"mx_Field mx_Field_select\\"><select type=\\"text\\" id=\\"mx_Field_5\\"><option value=\\"org.matrix.msc3381.poll.disclosed\\">Open poll</option><option value=\\"org.matrix.msc3381.poll.undisclosed\\">Closed poll</option></select><label for=\\"mx_Field_5\\"></label></div><p>Voters see results as soon as they have voted</p><h2>What is your poll question or topic?</h2><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"poll-topic-input\\" maxlength=\\"340\\" label=\\"Question or topic\\" placeholder=\\"Write something...\\" type=\\"text\\" value=\\"Poll Q\\"><label for=\\"poll-topic-input\\">Question or topic</label></div><h2>Create options</h2><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_0\\" maxlength=\\"340\\" label=\\"Option 1\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"Answer 1\\"><label for=\\"pollcreate_option_0\\">Option 1</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div class=\\"mx_PollCreateDialog_option\\"><div class=\\"mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint\\"><input id=\\"pollcreate_option_1\\" maxlength=\\"340\\" label=\\"Option 2\\" placeholder=\\"Write an option\\" type=\\"text\\" value=\\"Answer 2\\"><label for=\\"pollcreate_option_1\\">Option 2</label></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_removeOption\\"></div></div><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_PollCreateDialog_addOption mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary\\">Add option</div></div></div><div class=\\"mx_CompoundDialog_footer\\"><div role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline\\">Cancel</div><button type=\\"submit\\" role=\\"button\\" tabindex=\\"0\\" class=\\"mx_AccessibleButton mx_Dialog_nonDialogButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary\\">Done</button></div></form></div><div data-focus-guard=\\"true\\" tabindex=\\"0\\" style=\\"width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;\\"></div>"`;
exports[`PollCreateDialog renders info from a previous event 1`] = `"<div data-focus-guard="true" tabindex="0" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"></div><div data-focus-lock-disabled="false" role="dialog" aria-labelledby="mx_CompoundDialog_title" aria-describedby="mx_CompoundDialog_content" class="mx_CompoundDialog mx_ScrollableBaseDialog"><div class="mx_CompoundDialog_header"><h1>Edit poll</h1><div aria-label="Close dialog" role="button" tabindex="0" class="mx_AccessibleButton mx_CompoundDialog_cancelButton"></div></div><form><div class="mx_CompoundDialog_content"><div class="mx_PollCreateDialog"><h2>Poll type</h2><div class="mx_Field mx_Field_select"><select type="text" id="mx_Field_5"><option value="org.matrix.msc3381.poll.disclosed">Open poll</option><option value="org.matrix.msc3381.poll.undisclosed">Closed poll</option></select><label for="mx_Field_5"></label></div><p>Voters see results as soon as they have voted</p><h2>What is your poll question or topic?</h2><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="poll-topic-input" maxlength="340" label="Question or topic" placeholder="Write something..." type="text" value="Poll Q"><label for="poll-topic-input">Question or topic</label></div><h2>Create options</h2><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_0" maxlength="340" label="Option 1" placeholder="Write an option" type="text" value="Answer 1"><label for="pollcreate_option_0">Option 1</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div class="mx_PollCreateDialog_option"><div class="mx_Field mx_Field_input mx_Field_labelAlwaysTopLeft mx_Field_placeholderIsHint"><input id="pollcreate_option_1" maxlength="340" label="Option 2" placeholder="Write an option" type="text" value="Answer 2"><label for="pollcreate_option_1">Option 2</label></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_removeOption"></div></div><div role="button" tabindex="0" class="mx_AccessibleButton mx_PollCreateDialog_addOption mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary">Add option</div></div></div><div class="mx_CompoundDialog_footer"><div role="button" tabindex="0" class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline">Cancel</div><button type="submit" role="button" tabindex="0" class="mx_AccessibleButton mx_Dialog_nonDialogButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary">Done</button></div></form></div><div data-focus-guard="true" tabindex="0" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"></div>"`;

View file

@ -479,7 +479,5 @@ describe('<LocationShareMenu />', () => {
function enableSettings(settings: string[]) {
mocked(SettingsStore).getValue.mockReturnValue(false);
mocked(SettingsStore).getValue.mockImplementation(
(settingName: string) => settings.includes(settingName),
);
mocked(SettingsStore).getValue.mockImplementation((settingName: string): any => settings.includes(settingName));
}

View file

@ -18,20 +18,20 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
id="mx_LocationViewDialog_$2-marker"
map={
MockMap {
"_events": Object {
"_events": {
"error": [Function],
},
"_eventsCount": 1,
"_maxListeners": undefined,
"addControl": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
mockConstructor {},
"top-right",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -40,16 +40,16 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
"fitBounds": [MockFunction],
"removeControl": [MockFunction],
"setCenter": [MockFunction] {
"calls": Array [
Array [
Object {
"calls": [
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -86,20 +86,20 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
<ZoomButtons
map={
MockMap {
"_events": Object {
"_events": {
"error": [Function],
},
"_eventsCount": 1,
"_maxListeners": undefined,
"addControl": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
mockConstructor {},
"top-right",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -108,16 +108,16 @@ exports[`<LocationViewDialog /> renders map correctly 1`] = `
"fitBounds": [MockFunction],
"removeControl": [MockFunction],
"setCenter": [MockFunction] {
"calls": Array [
Array [
Object {
"calls": [
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},

View file

@ -5,7 +5,7 @@ exports[`<SmartMarker /> creates a marker on mount 1`] = `
geoUri="geo:43.2,54.6"
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],
@ -44,7 +44,7 @@ exports[`<SmartMarker /> removes marker on unmount 1`] = `
geoUri="geo:43.2,54.6"
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],

View file

@ -4,7 +4,7 @@ exports[`<ZoomButtons /> renders buttons 1`] = `
<ZoomButtons
map={
MockMap {
"_events": Object {},
"_events": {},
"_eventsCount": 0,
"_maxListeners": undefined,
"addControl": [MockFunction],

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import { mocked } from "jest-mock";
import { ISendEventResponse, MatrixClient } from "matrix-js-sdk/src/matrix";
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { makeLocationContent } from "matrix-js-sdk/src/content-helpers";
import { LegacyLocationEventContent, MLocationEventContent } from "matrix-js-sdk/src/@types/location";
@ -47,9 +47,9 @@ describe("shareLocation", () => {
} as unknown as MatrixClient;
mocked(makeLocationContent).mockReturnValue(content);
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
client?: MatrixClient,
) => {
return fn(roomId);

View file

@ -113,7 +113,7 @@ describe("DateSeparator", () => {
describe('when feature_jump_to_date is enabled', () => {
beforeEach(() => {
mocked(SettingsStore).getValue.mockImplementation((arg) => {
mocked(SettingsStore).getValue.mockImplementation((arg): any => {
if (arg === "feature_jump_to_date") {
return true;
}

View file

@ -122,11 +122,19 @@ describe("MKeyVerificationConclusion", () => {
mockClient.checkUserTrust.mockReturnValue(trustworthy);
/* Ensure we don't rerender for every trust status change of any user */
mockClient.emit(CryptoEvent.UserTrustStatusChanged, "@anotheruser:domain");
mockClient.emit(
CryptoEvent.UserTrustStatusChanged,
"@anotheruser:domain",
new UserTrustLevel(true, true, true),
);
expect(renderer.toJSON()).toBeNull();
/* But when our user changes, we do rerender */
mockClient.emit(CryptoEvent.UserTrustStatusChanged, event.verificationRequest.otherUserId);
mockClient.emit(
CryptoEvent.UserTrustStatusChanged,
event.verificationRequest.otherUserId,
new UserTrustLevel(true, true, true),
);
expect(renderer.toJSON()).not.toBeNull();
});
});

View file

@ -31,19 +31,19 @@ exports[`MLocationBody <MLocationBody> with error displays correct fallback cont
exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] = `
<MLocationBody
highlightLink=""
highlights={Array []}
mediaEventHelper={Object {}}
highlights={[]}
mediaEventHelper={{}}
mxEvent={
Object {
"content": Object {
{
"content": {
"body": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000",
"geo_uri": "geo:51.5076,-0.1276",
"msgtype": "m.location",
"org.matrix.msc1767.text": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000",
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.pin",
},
"org.matrix.msc3488.location": Object {
"org.matrix.msc3488.location": {
"description": "Human-readable label",
"uri": "geo:51.5076,-0.1276",
},
@ -55,21 +55,21 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
}
onHeightChanged={[MockFunction]}
onMessageAllowed={[MockFunction]}
permalinkCreator={Object {}}
permalinkCreator={{}}
>
<LocationBodyContent
mapId="mx_MLocationBody_$2_HHHHHHHH"
mxEvent={
Object {
"content": Object {
{
"content": {
"body": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000",
"geo_uri": "geo:51.5076,-0.1276",
"msgtype": "m.location",
"org.matrix.msc1767.text": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000",
"org.matrix.msc3488.asset": Object {
"org.matrix.msc3488.asset": {
"type": "m.pin",
},
"org.matrix.msc3488.location": Object {
"org.matrix.msc3488.location": {
"description": "Human-readable label",
"uri": "geo:51.5076,-0.1276",
},
@ -116,8 +116,8 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
id="mx_MLocationBody_$2_HHHHHHHH-marker"
map={
MockMap {
"_events": Object {
"error": Array [
"_events": {
"error": [
[Function],
[Function],
[Function],
@ -129,22 +129,22 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
"_eventsCount": 1,
"_maxListeners": undefined,
"addControl": [MockFunction] {
"calls": Array [
Array [
"calls": [
[
mockConstructor {},
"top-right",
],
Array [
[
mockConstructor {},
"top-right",
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
Object {
{
"type": "return",
"value": undefined,
},
@ -153,26 +153,26 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
"fitBounds": [MockFunction],
"removeControl": [MockFunction],
"setCenter": [MockFunction] {
"calls": Array [
Array [
Object {
"calls": [
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
Array [
Object {
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
Object {
{
"type": "return",
"value": undefined,
},

View file

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MVideoBody does not crash when given a portrait image 1`] = `"<span class=\\"mx_MVideoBody\\"><div class=\\"mx_MVideoBody_container\\" style=\\"max-width: 182px; max-height: 324px;\\"><video class=\\"mx_MVideoBody\\" controls=\\"\\" controlslist=\\"nodownload\\" preload=\\"none\\" poster=\\"data:image/png;base64,00\\"></video><div style=\\"width: 182px; height: 324px;\\"></div></div></span>"`;
exports[`MVideoBody does not crash when given a portrait image 1`] = `"<span class="mx_MVideoBody"><div class="mx_MVideoBody_container" style="max-width: 182px; max-height: 324px;"><video class="mx_MVideoBody" controls="" controlslist="nodownload" preload="none" poster="data:image/png;base64,00"></video><div style="width: 182px; height: 324px;"></div></div></span>"`;

View file

@ -1,17 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<TextualBody /> renders formatted m.text correctly linkification is not applied to code blocks 1`] = `
"<span class=\\"mx_EventTile_body markdown-body\\" dir=\\"auto\\"><p>Visit <code>https://matrix.org/</code></p>
<div class=\\"mx_EventTile_pre_container\\"><pre class=\\"mx_EventTile_collapsedCodeBlock\\"><span class=\\"mx_EventTile_lineNumbers\\"><span>1</span></span><code>https://matrix.org/
</code><span></span></pre><span class=\\"mx_EventTile_button mx_EventTile_copyButton \\"></span></div>
"<span class="mx_EventTile_body markdown-body" dir="auto"><p>Visit <code>https://matrix.org/</code></p>
<div class="mx_EventTile_pre_container"><pre class="mx_EventTile_collapsedCodeBlock"><span class="mx_EventTile_lineNumbers"><span>1</span></span><code>https://matrix.org/
</code><span></span></pre><span class="mx_EventTile_button mx_EventTile_copyButton "></span></div>
</span>"
`;
exports[`<TextualBody /> renders formatted m.text correctly pills do not appear in code blocks 1`] = `
"<span class=\\"mx_EventTile_body markdown-body\\" dir=\\"auto\\"><p><code>@room</code></p>
<div class=\\"mx_EventTile_pre_container\\"><pre class=\\"mx_EventTile_collapsedCodeBlock\\"><span class=\\"mx_EventTile_lineNumbers\\"><span>1</span></span><code>@room
</code><span></span></pre><span class=\\"mx_EventTile_button mx_EventTile_copyButton \\"></span></div>
"<span class="mx_EventTile_body markdown-body" dir="auto"><p><code>@room</code></p>
<div class="mx_EventTile_pre_container"><pre class="mx_EventTile_collapsedCodeBlock"><span class="mx_EventTile_lineNumbers"><span>1</span></span><code>@room
</code><span></span></pre><span class="mx_EventTile_button mx_EventTile_copyButton "></span></div>
</span>"
`;
exports[`<TextualBody /> renders formatted m.text correctly pills get injected correctly into the DOM 1`] = `"<span class=\\"mx_EventTile_body markdown-body\\" dir=\\"auto\\">Hey <span><bdi><a class=\\"mx_Pill mx_UserPill\\"><img class=\\"mx_BaseAvatar mx_BaseAvatar_image\\" src=\\"mxc://avatar.url/image.png\\" style=\\"width: 16px; height: 16px;\\" alt=\\"\\" aria-hidden=\\"true\\"><span class=\\"mx_Pill_linkText\\">Member</span></a></bdi></span></span>"`;
exports[`<TextualBody /> renders formatted m.text correctly pills get injected correctly into the DOM 1`] = `"<span class="mx_EventTile_body markdown-body" dir="auto">Hey <span><bdi><a class="mx_Pill mx_UserPill"><img class="mx_BaseAvatar mx_BaseAvatar_image" src="mxc://avatar.url/image.png" style="width: 16px; height: 16px;" alt="" aria-hidden="true"><span class="mx_Pill_linkText">Member</span></a></bdi></span></span>"`;

View file

@ -58,7 +58,7 @@ describe("<PinnedMessagesCard />", () => {
const pins = () => [...localPins, ...nonLocalPins];
// Insert pin IDs into room state
mocked(room.currentState).getStateEvents.mockImplementation(() => mkEvent({
mocked(room.currentState).getStateEvents.mockImplementation((): any => mkEvent({
event: true,
type: EventType.RoomPinnedEvents,
content: {

View file

@ -17,7 +17,7 @@ limitations under the License.
import React from "react";
import { act } from "react-dom/test-utils";
import { sleep } from "matrix-js-sdk/src/utils";
import { ISendEventResponse, MatrixClient, MsgType, RelationType } from "matrix-js-sdk/src/matrix";
import { MatrixClient, MsgType, RelationType } from "matrix-js-sdk/src/matrix";
// eslint-disable-next-line deprecate/import
import { mount } from 'enzyme';
import { mocked } from "jest-mock";
@ -303,9 +303,9 @@ describe('<SendMessageComposer/>', () => {
});
it("correctly sends a message", () => {
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T extends {}>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
_client?: MatrixClient,
) => {
return fn(roomId);

View file

@ -17,7 +17,7 @@ limitations under the License.
import React from "react";
// eslint-disable-next-line deprecate/import
import { mount, ReactWrapper } from "enzyme";
import { ISendEventResponse, MatrixClient, MsgType, Room } from "matrix-js-sdk/src/matrix";
import { MatrixClient, MsgType, Room } from "matrix-js-sdk/src/matrix";
import { mocked } from "jest-mock";
import VoiceRecordComposerTile from "../../../../src/components/views/rooms/VoiceRecordComposerTile";
@ -65,9 +65,9 @@ describe("<VoiceRecordComposerTile/>", () => {
recorder: mockRecorder,
});
mocked(doMaybeLocalRoomAction).mockImplementation((
mocked(doMaybeLocalRoomAction).mockImplementation(<T extends {}>(
roomId: string,
fn: (actualRoomId: string) => Promise<ISendEventResponse>,
fn: (actualRoomId: string) => Promise<T>,
_client?: MatrixClient,
) => {
return fn(roomId);

View file

@ -34,7 +34,7 @@ exports[`FontScalingPanel renders the font scaling UI 1`] = `
data-testid="spinner"
role="progressbar"
style={
Object {
{
"height": 32,
"width": 32,
}
@ -58,7 +58,7 @@ exports[`FontScalingPanel renders the font scaling UI 1`] = `
onSelectionChange={[Function]}
value={15}
values={
Array [
[
13,
14,
15,
@ -83,7 +83,7 @@ exports[`FontScalingPanel renders the font scaling UI 1`] = `
<div
className="mx_Slider_selectionDot"
style={
Object {
{
"left": "calc(-1.195em + 50%)",
}
}
@ -96,7 +96,7 @@ exports[`FontScalingPanel renders the font scaling UI 1`] = `
</div>
<hr
style={
Object {
{
"width": "50%",
}
}

View file

@ -15,14 +15,14 @@ exports[`ThemeChoicePanel renders the theme choice UI 1`] = `
>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"className": "mx_ThemeSelector_light",
"disabled": true,
"label": "Light",
"value": "light",
},
Object {
{
"className": "mx_ThemeSelector_dark",
"disabled": true,
"label": "Dark",

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<DeviceDetailHeading /> displays name edit form on rename button click 1`] = `
Object {
{
"container": <div>
<form
aria-disabled="false"
@ -72,7 +72,7 @@ Object {
`;
exports[`<DeviceDetailHeading /> renders device name 1`] = `
Object {
{
"container": <div>
<div
class="mx_DeviceDetailHeading"

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<DeviceExpandDetailsButton /> renders when expanded 1`] = `
Object {
{
"container": <div>
<div
aria-label="Toggle device details"
@ -18,7 +18,7 @@ Object {
`;
exports[`<DeviceExpandDetailsButton /> renders when not expanded 1`] = `
Object {
{
"container": <div>
<div
aria-label="Toggle device details"

View file

@ -1,29 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`deleteDevices() opens interactive auth dialog when delete fails with 401 1`] = `
Object {
"m.login.sso": Object {
"1": Object {
{
"m.login.sso": {
"1": {
"body": "Confirm logging out these devices by using Single Sign On to prove your identity.",
"continueKind": "primary",
"continueText": "Single Sign On",
"title": "Use Single Sign On to continue",
},
"2": Object {
"2": {
"body": "Click the button below to confirm signing out these devices.",
"continueKind": "danger",
"continueText": "Sign out devices",
"title": "Confirm signing out these devices",
},
},
"org.matrix.login.sso": Object {
"1": Object {
"org.matrix.login.sso": {
"1": {
"body": "Confirm logging out these devices by using Single Sign On to prove your identity.",
"continueKind": "primary",
"continueText": "Single Sign On",
"title": "Use Single Sign On to continue",
},
"2": Object {
"2": {
"body": "Click the button below to confirm signing out these devices.",
"continueKind": "danger",
"continueText": "Sign out devices",

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<SettingsSubsectionHeading /> renders with children 1`] = `
Object {
{
"container": <div>
<div
class="mx_SettingsSubsectionHeading"
@ -22,7 +22,7 @@ Object {
`;
exports[`<SettingsSubsectionHeading /> renders without children 1`] = `
Object {
{
"container": <div>
<div
class="mx_SettingsSubsectionHeading"

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Caption /> renders plain text children 1`] = `
Object {
{
"container": <div>
<span
class="mx_Caption"
@ -14,7 +14,7 @@ Object {
`;
exports[`<Caption /> renders react children 1`] = `
Object {
{
"container": <div>
<span
class="mx_Caption"

View file

@ -1,76 +1,76 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`editor/deserialize html messages escapes angle brackets 1`] = `
Array [
Object {
"text": "\\\\> \\\\\\\\<del>no formatting here\\\\\\\\</del>",
[
{
"text": "\\> \\\\<del>no formatting here\\\\</del>",
"type": "plain",
},
]
`;
exports[`editor/deserialize html messages escapes asterisks 1`] = `
Array [
Object {
"text": "\\\\*hello\\\\*",
[
{
"text": "\\*hello\\*",
"type": "plain",
},
]
`;
exports[`editor/deserialize html messages escapes backslashes 1`] = `
Array [
Object {
"text": "C:\\\\\\\\My Documents",
[
{
"text": "C:\\\\My Documents",
"type": "plain",
},
]
`;
exports[`editor/deserialize html messages escapes backticks in code blocks 1`] = `
Array [
Object {
[
{
"text": "\`\`this → \` is a backtick\`\`",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "\`\`\`\`",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "and here are 3 of them:",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "\`\`\`",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "\`\`\`\`",
"type": "plain",
},
@ -78,35 +78,35 @@ Array [
`;
exports[`editor/deserialize html messages escapes backticks outside of code blocks 1`] = `
Array [
Object {
"text": "some \\\\\`backticks\\\\\`",
[
{
"text": "some \\\`backticks\\\`",
"type": "plain",
},
]
`;
exports[`editor/deserialize html messages escapes square brackets 1`] = `
Array [
Object {
"text": "\\\\[not an actual link\\\\](https://example.org)",
[
{
"text": "\\[not an actual link\\](https://example.org)",
"type": "plain",
},
]
`;
exports[`editor/deserialize html messages escapes underscores 1`] = `
Array [
Object {
"text": "\\\\_\\\\_emphasis\\\\_\\\\_",
[
{
"text": "\\_\\_emphasis\\_\\_",
"type": "plain",
},
]
`;
exports[`editor/deserialize html messages preserves nested formatting 1`] = `
Array [
Object {
[
{
"text": "a<sub>b_c**d<u>e</u>**_</sub>",
"type": "plain",
},
@ -114,26 +114,26 @@ Array [
`;
exports[`editor/deserialize html messages preserves nested quotes 1`] = `
Array [
Object {
[
{
"text": "> foo",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "> ",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "> > bar",
"type": "plain",
},
@ -141,36 +141,36 @@ Array [
`;
exports[`editor/deserialize html messages surrounds lists with newlines 1`] = `
Array [
Object {
[
{
"text": "foo",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "- bar",
"type": "plain",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "
",
"type": "newline",
},
Object {
{
"text": "baz",
"type": "plain",
},

View file

@ -213,7 +213,7 @@ describe("JitsiCall", () => {
({ widget, messaging, audioMutedSpy, videoMutedSpy } = setUpWidget(call));
mocked(messaging.transport).send.mockImplementation(async (action: string) => {
mocked(messaging.transport).send.mockImplementation(async (action: string): Promise<any> => {
if (action === ElementWidgetActions.JoinCall) {
messaging.emit(
`action:${ElementWidgetActions.JoinCall}`,
@ -296,7 +296,7 @@ describe("JitsiCall", () => {
});
it("handles instant remote disconnection when connecting", async () => {
mocked(messaging.transport).send.mockImplementation(async action => {
mocked(messaging.transport).send.mockImplementation(async (action): Promise<any> => {
if (action === ElementWidgetActions.JoinCall) {
// Emit the hangup event *before* the join event to fully
// exercise the race condition

View file

@ -1,54 +1,54 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StopGapWidgetDriver sendToDevice sends encrypted messages 1`] = `
Array [
Array [
Array [
Object {
[
[
[
{
"deviceInfo": DeviceInfo {
"algorithms": Array [],
"algorithms": [],
"deviceId": "aliceWeb",
"keys": Object {},
"keys": {},
"known": false,
"signatures": Object {},
"unsigned": Object {},
"signatures": {},
"unsigned": {},
"verified": 0,
},
"userId": "@alice:example.org",
},
Object {
{
"deviceInfo": DeviceInfo {
"algorithms": Array [],
"algorithms": [],
"deviceId": "aliceMobile",
"keys": Object {},
"keys": {},
"known": false,
"signatures": Object {},
"unsigned": Object {},
"signatures": {},
"unsigned": {},
"verified": 0,
},
"userId": "@alice:example.org",
},
],
Object {
{
"hello": "alice",
},
],
Array [
Array [
Object {
[
[
{
"deviceInfo": DeviceInfo {
"algorithms": Array [],
"algorithms": [],
"deviceId": "bobDesktop",
"keys": Object {},
"keys": {},
"known": false,
"signatures": Object {},
"unsigned": Object {},
"signatures": {},
"unsigned": {},
"verified": 0,
},
"userId": "@bob:example.org",
},
],
Object {
{
"hello": "bob",
},
],
@ -56,20 +56,20 @@ Array [
`;
exports[`StopGapWidgetDriver sendToDevice sends unencrypted messages 1`] = `
Array [
Array [
Object {
"batch": Array [
Object {
[
[
{
"batch": [
{
"deviceId": "*",
"payload": Object {
"payload": {
"hello": "alice",
},
"userId": "@alice:example.org",
},
Object {
{
"deviceId": "bobDesktop",
"payload": Object {
"payload": {
"hello": "bob",
},
"userId": "@bob:example.org",

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import EventEmitter from "events";
import { MethodKeysOf, mocked, MockedObject, PropertyKeysOf } from "jest-mock";
import { MethodLikeKeys, mocked, MockedObject, PropertyLikeKeys } from "jest-mock";
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
import { MatrixClient, User } from "matrix-js-sdk/src/matrix";
@ -32,7 +32,7 @@ export class MockEventEmitter<T> extends EventEmitter {
* @param mockProperties An object with the mock property or function implementations. 'getters'
* are correctly cloned to this event emitter.
*/
constructor(mockProperties: Partial<Record<MethodKeysOf<T>|PropertyKeysOf<T>, unknown>> = {}) {
constructor(mockProperties: Partial<Record<MethodLikeKeys<T>|PropertyLikeKeys<T>, unknown>> = {}) {
super();
// We must use defineProperties and not assign as the former clones getters correctly,
// whereas the latter invokes the getter and sets the return value permanently on the
@ -47,7 +47,7 @@ export class MockEventEmitter<T> extends EventEmitter {
* to MatrixClient events
*/
export class MockClientWithEventEmitter extends EventEmitter {
constructor(mockProperties: Partial<Record<MethodKeysOf<MatrixClient>, unknown>> = {}) {
constructor(mockProperties: Partial<Record<MethodLikeKeys<MatrixClient>, unknown>> = {}) {
super();
Object.assign(this, mockProperties);
@ -66,12 +66,13 @@ export class MockClientWithEventEmitter extends EventEmitter {
* ```
*/
export const getMockClientWithEventEmitter = (
mockProperties: Partial<Record<MethodKeysOf<MatrixClient>, unknown>>,
mockProperties: Partial<Record<MethodLikeKeys<MatrixClient>, unknown>>,
): MockedObject<MatrixClient> => {
const mock = mocked(new MockClientWithEventEmitter(mockProperties) as unknown as MatrixClient);
jest.spyOn(MatrixClientPeg, 'get').mockReturnValue(mock);
// @ts-ignore simplified test stub
mock.canSupport = new Map();
Object.keys(Feature).forEach(feature => {
mock.canSupport.set(feature as Feature, ServerSupport.Stable);
@ -117,7 +118,7 @@ export const mockClientMethodsEvents = () => ({
/**
* Returns basic mocked client methods related to server support
*/
export const mockClientMethodsServer = (): Partial<Record<MethodKeysOf<MatrixClient>, unknown>> => ({
export const mockClientMethodsServer = (): Partial<Record<MethodLikeKeys<MatrixClient>, unknown>> => ({
doesServerSupportSeparateAddAndBind: jest.fn(),
getIdentityServerUrl: jest.fn(),
getHomeserverUrl: jest.fn(),
@ -130,14 +131,14 @@ export const mockClientMethodsServer = (): Partial<Record<MethodKeysOf<MatrixCli
export const mockClientMethodsDevice = (
deviceId = 'test-device-id',
): Partial<Record<MethodKeysOf<MatrixClient>, unknown>> => ({
): Partial<Record<MethodLikeKeys<MatrixClient>, unknown>> => ({
getDeviceId: jest.fn().mockReturnValue(deviceId),
getDeviceEd25519Key: jest.fn(),
getDevices: jest.fn().mockResolvedValue({ devices: [] }),
});
export const mockClientMethodsCrypto = (): Partial<Record<
MethodKeysOf<MatrixClient> & PropertyKeysOf<MatrixClient>, unknown>
MethodLikeKeys<MatrixClient> & PropertyLikeKeys<MatrixClient>, unknown>
> => ({
isCryptoEnabled: jest.fn(),
isSecretStorageReady: jest.fn(),

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { MethodKeysOf, mocked, MockedObject } from "jest-mock";
import { MethodLikeKeys, mocked, MockedObject } from "jest-mock";
import BasePlatform from "../../src/BasePlatform";
import PlatformPeg from "../../src/PlatformPeg";
@ -22,7 +22,7 @@ import PlatformPeg from "../../src/PlatformPeg";
// doesn't implement abstract
// @ts-ignore
class MockPlatform extends BasePlatform {
constructor(platformMocks: Partial<Record<MethodKeysOf<BasePlatform>, unknown>>) {
constructor(platformMocks: Partial<Record<MethodLikeKeys<BasePlatform>, unknown>>) {
super();
Object.assign(this, platformMocks);
}
@ -34,7 +34,7 @@ class MockPlatform extends BasePlatform {
* @returns MockPlatform instance
*/
export const mockPlatformPeg = (
platformMocks: Partial<Record<MethodKeysOf<BasePlatform>, unknown>> = {},
platformMocks: Partial<Record<MethodLikeKeys<BasePlatform>, unknown>> = {},
): MockedObject<BasePlatform> => {
const mockPlatform = new MockPlatform(platformMocks);
jest.spyOn(PlatformPeg, 'get').mockReturnValue(mockPlatform);

View file

@ -72,12 +72,14 @@ function stringToArray(s: string): ArrayBufferLike {
describe('MegolmExportEncryption', function() {
let MegolmExportEncryption;
beforeAll(() => {
beforeEach(() => {
window.crypto = {
subtle: webCrypto.subtle,
getRandomValues,
randomUUID: jest.fn().mockReturnValue("not-random-uuid"),
subtle: webCrypto.subtle,
};
// @ts-ignore for some reason including it in the object above gets ignored
window.crypto.subtle = webCrypto.subtle;
MegolmExportEncryption = require("../../src/utils/MegolmExportEncryption");
});
@ -142,8 +144,7 @@ cissyYBxjsfsAn
describe('encrypt', function() {
it('should round-trip', function() {
const input =
'words words many words in plain text here'.repeat(100);
const input = 'words words many words in plain text here'.repeat(100);
const password = 'my super secret passphrase';

View file

@ -1,32 +1,32 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`createVoiceMessageContent should create a voice message content 1`] = `
Object {
{
"body": "Voice message",
"file": Object {},
"info": Object {
"file": {},
"info": {
"duration": 23000,
"mimetype": "ogg/opus",
"size": 42000,
},
"msgtype": "m.audio",
"org.matrix.msc1767.audio": Object {
"org.matrix.msc1767.audio": {
"duration": 23000,
"waveform": Array [
"waveform": [
1,
2,
3,
],
},
"org.matrix.msc1767.file": Object {
"file": Object {},
"org.matrix.msc1767.file": {
"file": {},
"mimetype": "ogg/opus",
"name": "Voice message.ogg",
"size": 42000,
"url": "mxc://example.com/file",
},
"org.matrix.msc1767.text": "Voice message",
"org.matrix.msc3245.voice": Object {},
"org.matrix.msc3245.voice": {},
"url": "mxc://example.com/file",
}
`;

View file

@ -23,7 +23,7 @@ import HTMLExporter from "../../../src/utils/exportUtils/HtmlExport";
describe("HTMLExport", () => {
beforeEach(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers();
jest.setSystemTime(REPEATABLE_DATE);
});

View file

@ -20,7 +20,7 @@ import { ExportType, IExportOptions } from "../../../src/utils/exportUtils/expor
describe("JSONExport", () => {
beforeEach(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers();
jest.setSystemTime(REPEATABLE_DATE);
});

View file

@ -20,7 +20,7 @@ import PlainTextExporter from "../../../src/utils/exportUtils/PlainTextExport";
describe("PlainTextExport", () => {
beforeEach(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers();
jest.setSystemTime(REPEATABLE_DATE);
});

View file

@ -67,11 +67,9 @@ describe('notifications', () => {
it.each(deviceNotificationSettingsKeys)(
'unsilenced for existing sessions when %s setting is truthy',
async (settingKey) => {
mocked(SettingsStore)
.getValue
.mockImplementation((key) => {
return key === settingKey;
});
mocked(SettingsStore).getValue.mockImplementation((key): any => {
return key === settingKey;
});
await createLocalNotificationSettingsIfNeeded(mockClient);
const event = mockClient.getAccountData(accountDataEventKey);

View file

@ -153,7 +153,7 @@ describe("VoiceBroadcastPlayback", () => {
},
);
mocked(MediaEventHelper).mockImplementation((event: MatrixEvent) => {
mocked(MediaEventHelper).mockImplementation((event: MatrixEvent): any => {
if (event === chunk1Event) return chunk1Helper;
if (event === chunk2Event) return chunk2Helper;
if (event === chunk3Event) return chunk3Helper;

View file

@ -130,15 +130,13 @@ describe("VoiceBroadcastRecording", () => {
mocked(createVoiceBroadcastRecorder).mockReturnValue(voiceBroadcastRecorder);
onChunkRecorded = jest.fn();
mocked(voiceBroadcastRecorder.on).mockImplementation(
(event: VoiceBroadcastRecorderEvent, listener: any): VoiceBroadcastRecorder => {
if (event === VoiceBroadcastRecorderEvent.ChunkRecorded) {
onChunkRecorded = listener;
}
mocked(voiceBroadcastRecorder.on).mockImplementation((event: any, listener: any): VoiceBroadcastRecorder => {
if (event === VoiceBroadcastRecorderEvent.ChunkRecorded) {
onChunkRecorded = listener;
}
return voiceBroadcastRecorder;
},
);
return voiceBroadcastRecorder;
});
mocked(uploadFile).mockResolvedValue({
url: uploadedUrl,

View file

@ -2,10 +2,10 @@
exports[`startNewVoiceBroadcastRecording when the current user is allowed to send voice broadcast info state events when there already is a live broadcast of another user should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.
</p>,
@ -14,8 +14,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -25,10 +25,10 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
exports[`startNewVoiceBroadcastRecording when the current user is allowed to send voice broadcast info state events when there already is a live broadcast of the current user in the room should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.
</p>,
@ -37,8 +37,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -48,10 +48,10 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
exports[`startNewVoiceBroadcastRecording when the current user is allowed to send voice broadcast info state events when there is already a current voice broadcast should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.
</p>,
@ -60,8 +60,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -71,10 +71,10 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
exports[`startNewVoiceBroadcastRecording when the current user is not allowed to send voice broadcast info state events should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.
</p>,
@ -83,8 +83,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is not allowed to
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},

View file

@ -88,7 +88,7 @@ describe("startNewVoiceBroadcastRecording", () => {
mocked(VoiceBroadcastRecording).mockImplementation((
infoEvent: MatrixEvent,
client: MatrixClient,
) => {
): any => {
return {
infoEvent,
client,

1482
yarn.lock

File diff suppressed because it is too large Load diff