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 - name: Install Deps
run: "./scripts/ci/install-deps.sh --ignore-scripts" 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 - 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 - name: Upload Artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2

View file

@ -137,7 +137,7 @@
"@babel/traverse": "^7.12.12", "@babel/traverse": "^7.12.12",
"@casualbot/jest-sonar-reporter": "^2.2.5", "@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", "@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/cli": "^1.11.0",
"@percy/cypress": "^3.1.2", "@percy/cypress": "^3.1.2",
"@sentry/types": "^6.10.0", "@sentry/types": "^6.10.0",
@ -155,7 +155,7 @@
"@types/file-saver": "^2.0.3", "@types/file-saver": "^2.0.3",
"@types/flux": "^3.1.9", "@types/flux": "^3.1.9",
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^9.0.13",
"@types/jest": "^26.0.20", "@types/jest": "^29.2.1",
"@types/katex": "^0.14.0", "@types/katex": "^0.14.0",
"@types/lodash": "^4.14.168", "@types/lodash": "^4.14.168",
"@types/modernizr": "^3.5.3", "@types/modernizr": "^3.5.3",
@ -195,10 +195,10 @@
"fetch-mock-jest": "^1.5.1", "fetch-mock-jest": "^1.5.1",
"fs-extra": "^10.0.1", "fs-extra": "^10.0.1",
"glob": "^7.1.6", "glob": "^7.1.6",
"jest": "^27.4.0", "jest": "^29.2.2",
"jest-canvas-mock": "^2.3.0", "jest-canvas-mock": "^2.3.0",
"jest-environment-jsdom": "^27.0.6", "jest-environment-jsdom": "^29.2.2",
"jest-mock": "^27.5.1", "jest-mock": "^29.2.2",
"jest-raw-loader": "^1.0.1", "jest-raw-loader": "^1.0.1",
"matrix-mock-request": "^2.5.0", "matrix-mock-request": "^2.5.0",
"matrix-web-i18n": "^1.3.0", "matrix-web-i18n": "^1.3.0",

View file

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

View file

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

View file

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

View file

@ -1,46 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Reply getNestedReplyText Returns valid reply fallback text for m.text msgtypes 1`] = ` exports[`Reply getNestedReplyText Returns valid reply fallback text for m.text msgtypes 1`] = `
Object { {
"body": "> <@user1:server> body "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`] = ` 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. "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`] = ` 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. "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`] = ` 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. "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`] = ` 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. "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", () => { describe("getPlayback", () => {
beforeEach(() => { beforeEach(() => {
mocked(Playback).mockImplementation((buf: ArrayBuffer, seedWaveform) => { mocked(Playback).mockImplementation((buf: ArrayBuffer, seedWaveform): any => {
expect(new Uint8Array(buf)).toEqual(testBuf); expect(new Uint8Array(buf)).toEqual(testBuf);
expect(seedWaveform).toEqual(testAmplitudes); expect(seedWaveform).toEqual(testAmplitudes);
return {} as Playback; return {} as Playback;

View file

@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // 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(() => { beforeEach(() => {
// @ts-ignore writing to readonly variable
mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = true; mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = true;
mocked(OwnBeaconStore.instance).getLiveBeaconIdsWithLocationPublishError.mockReturnValue([]); mocked(OwnBeaconStore.instance).getLiveBeaconIdsWithLocationPublishError.mockReturnValue([]);
mocked(OwnBeaconStore.instance).getLiveBeaconIds.mockReturnValue([beacon2.identifier, beacon1.identifier]); mocked(OwnBeaconStore.instance).getLiveBeaconIds.mockReturnValue([beacon2.identifier, beacon1.identifier]);
@ -190,6 +191,7 @@ describe('<LeftPanelLiveShareWarning />', () => {
expect(container.innerHTML).toBeTruthy(); expect(container.innerHTML).toBeTruthy();
act(() => { act(() => {
// @ts-ignore writing to readonly variable
mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = false; mocked(OwnBeaconStore.instance).isMonitoringLiveLocation = false;
OwnBeaconStore.instance.emit(OwnBeaconStoreEvent.MonitoringLivePosition); OwnBeaconStore.instance.emit(OwnBeaconStoreEvent.MonitoringLivePosition);
}); });

View file

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

View file

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

View file

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

View file

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // 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`] = ` 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 <RoomLiveShareWarning
@ -12,7 +12,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
> >
<RoomLiveShareWarningInner <RoomLiveShareWarningInner
liveBeaconIds={ liveBeaconIds={
Array [ [
"$room2:server.org_@alice:server.org", "$room2:server.org_@alice:server.org",
] ]
} }

View file

@ -4,43 +4,43 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
<SpaceContextMenu <SpaceContextMenu
onFinished={[MockFunction]} onFinished={[MockFunction]}
space={ space={
Object { {
"canInvite": [MockFunction] { "canInvite": [MockFunction] {
"calls": Array [ "calls": [
Array [ [
"@test:server", "@test:server",
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },
], ],
}, },
"client": Object { "client": {
"getUserId": [MockFunction] { "getUserId": [MockFunction] {
"calls": Array [ "calls": [
Array [], [],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": "@test:server", "value": "@test:server",
}, },
], ],
}, },
}, },
"currentState": Object { "currentState": {
"maySendStateEvent": [MockFunction] { "maySendStateEvent": [MockFunction] {
"calls": Array [ "calls": [
Array [ [
"m.space.child", "m.space.child",
"@test:server", "@test:server",
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },
@ -48,11 +48,11 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
}, },
}, },
"getJoinRule": [MockFunction] { "getJoinRule": [MockFunction] {
"calls": Array [ "calls": [
Array [], [],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },
@ -180,7 +180,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
onContextMenu={[Function]} onContextMenu={[Function]}
onKeyDown={[Function]} onKeyDown={[Function]}
style={ style={
Object { {
"bottom": undefined, "bottom": undefined,
"right": undefined, "right": undefined,
} }
@ -190,12 +190,12 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_ContextualMenu_background" className="mx_ContextualMenu_background"
onClick={[Function]} onClick={[Function]}
onContextMenu={[Function]} onContextMenu={[Function]}
style={Object {}} style={{}}
/> />
<div <div
className="mx_ContextualMenu" className="mx_ContextualMenu"
role="menu" role="menu"
style={Object {}} style={{}}
> >
<div <div
className="mx_IconizedContextMenu mx_SpacePanel_contextMenu mx_IconizedContextMenu_compact" className="mx_IconizedContextMenu mx_SpacePanel_contextMenu mx_IconizedContextMenu_compact"
@ -232,7 +232,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_IconizedContextMenu_item" className="mx_IconizedContextMenu_item"
element="div" element="div"
inputRef={ inputRef={
Object { {
"current": <div "current": <div
aria-label="Space home" aria-label="Space home"
class="mx_AccessibleButton mx_IconizedContextMenu_item focus-visible" class="mx_AccessibleButton mx_IconizedContextMenu_item focus-visible"
@ -300,7 +300,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_IconizedContextMenu_item" className="mx_IconizedContextMenu_item"
element="div" element="div"
inputRef={ inputRef={
Object { {
"current": <div "current": <div
aria-label="Explore rooms" aria-label="Explore rooms"
class="mx_AccessibleButton mx_IconizedContextMenu_item" class="mx_AccessibleButton mx_IconizedContextMenu_item"
@ -367,7 +367,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
className="mx_IconizedContextMenu_item" className="mx_IconizedContextMenu_item"
element="div" element="div"
inputRef={ inputRef={
Object { {
"current": <div "current": <div
aria-label="Preferences" aria-label="Preferences"
class="mx_AccessibleButton mx_IconizedContextMenu_item" class="mx_AccessibleButton mx_IconizedContextMenu_item"
@ -439,7 +439,7 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
data-test-id="leave-option" data-test-id="leave-option"
element="div" element="div"
inputRef={ inputRef={
Object { {
"current": <div "current": <div
aria-label="Leave space" aria-label="Leave space"
class="mx_AccessibleButton mx_IconizedContextMenu_option_red mx_IconizedContextMenu_item" 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 // Make sendEvent require manual resolution so we can see the sending state
let finishSend; let finishSend;
let cancelSend; let cancelSend;
mockClient.sendEvent.mockImplementation(() => new Promise((resolve, reject) => { mockClient.sendEvent.mockImplementation(<T extends {}>() => new Promise<T>((resolve, reject) => {
finishSend = resolve; finishSend = resolve;
cancelSend = reject; cancelSend = reject;
})); }));

View file

@ -104,24 +104,27 @@ describe('<UserSettingsDialog />', () => {
}); });
it('renders ignored users tab when feature_mjolnir is enabled', () => { 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()); const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Mjolnir}`)).toBeTruthy(); expect(getByTestId(`settings-tab-${UserTab.Mjolnir}`)).toBeTruthy();
}); });
it('renders voip tab when voip is enabled', () => { 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()); const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Voice}`)).toBeTruthy(); expect(getByTestId(`settings-tab-${UserTab.Voice}`)).toBeTruthy();
}); });
it('renders session manager tab when enabled', () => { 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()); const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.SessionManager}`)).toBeTruthy(); expect(getByTestId(`settings-tab-${UserTab.SessionManager}`)).toBeTruthy();
}); });
it('renders labs tab when show_labs_settings is enabled in config', () => { 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"); mockSdkConfig.get.mockImplementation((configName) => configName === "show_labs_settings");
const { getByTestId } = render(getComponent()); const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Labs}`)).toBeTruthy(); expect(getByTestId(`settings-tab-${UserTab.Labs}`)).toBeTruthy();

View file

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

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // 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[]) { function enableSettings(settings: string[]) {
mocked(SettingsStore).getValue.mockReturnValue(false); mocked(SettingsStore).getValue.mockReturnValue(false);
mocked(SettingsStore).getValue.mockImplementation( mocked(SettingsStore).getValue.mockImplementation((settingName: string): any => settings.includes(settingName));
(settingName: string) => settings.includes(settingName),
);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -122,11 +122,19 @@ describe("MKeyVerificationConclusion", () => {
mockClient.checkUserTrust.mockReturnValue(trustworthy); mockClient.checkUserTrust.mockReturnValue(trustworthy);
/* Ensure we don't rerender for every trust status change of any user */ /* 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(); expect(renderer.toJSON()).toBeNull();
/* But when our user changes, we do rerender */ /* 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(); 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`] = ` exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] = `
<MLocationBody <MLocationBody
highlightLink="" highlightLink=""
highlights={Array []} highlights={[]}
mediaEventHelper={Object {}} mediaEventHelper={{}}
mxEvent={ mxEvent={
Object { {
"content": Object { "content": {
"body": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000", "body": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000",
"geo_uri": "geo:51.5076,-0.1276", "geo_uri": "geo:51.5076,-0.1276",
"msgtype": "m.location", "msgtype": "m.location",
"org.matrix.msc1767.text": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000", "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", "type": "m.pin",
}, },
"org.matrix.msc3488.location": Object { "org.matrix.msc3488.location": {
"description": "Human-readable label", "description": "Human-readable label",
"uri": "geo:51.5076,-0.1276", "uri": "geo:51.5076,-0.1276",
}, },
@ -55,21 +55,21 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
} }
onHeightChanged={[MockFunction]} onHeightChanged={[MockFunction]}
onMessageAllowed={[MockFunction]} onMessageAllowed={[MockFunction]}
permalinkCreator={Object {}} permalinkCreator={{}}
> >
<LocationBodyContent <LocationBodyContent
mapId="mx_MLocationBody_$2_HHHHHHHH" mapId="mx_MLocationBody_$2_HHHHHHHH"
mxEvent={ mxEvent={
Object { {
"content": Object { "content": {
"body": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000", "body": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000",
"geo_uri": "geo:51.5076,-0.1276", "geo_uri": "geo:51.5076,-0.1276",
"msgtype": "m.location", "msgtype": "m.location",
"org.matrix.msc1767.text": "Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000", "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", "type": "m.pin",
}, },
"org.matrix.msc3488.location": Object { "org.matrix.msc3488.location": {
"description": "Human-readable label", "description": "Human-readable label",
"uri": "geo:51.5076,-0.1276", "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" id="mx_MLocationBody_$2_HHHHHHHH-marker"
map={ map={
MockMap { MockMap {
"_events": Object { "_events": {
"error": Array [ "error": [
[Function], [Function],
[Function], [Function],
[Function], [Function],
@ -129,22 +129,22 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
"_eventsCount": 1, "_eventsCount": 1,
"_maxListeners": undefined, "_maxListeners": undefined,
"addControl": [MockFunction] { "addControl": [MockFunction] {
"calls": Array [ "calls": [
Array [ [
mockConstructor {}, mockConstructor {},
"top-right", "top-right",
], ],
Array [ [
mockConstructor {}, mockConstructor {},
"top-right", "top-right",
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },
@ -153,26 +153,26 @@ exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] =
"fitBounds": [MockFunction], "fitBounds": [MockFunction],
"removeControl": [MockFunction], "removeControl": [MockFunction],
"setCenter": [MockFunction] { "setCenter": [MockFunction] {
"calls": Array [ "calls": [
Array [ [
Object { {
"lat": 51.5076, "lat": 51.5076,
"lon": -0.1276, "lon": -0.1276,
}, },
], ],
Array [ [
Object { {
"lat": 51.5076, "lat": 51.5076,
"lon": -0.1276, "lon": -0.1276,
}, },
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },

View file

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // 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 // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<TextualBody /> renders formatted m.text correctly linkification is not applied to code blocks 1`] = ` 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> "<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/ <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> </code><span></span></pre><span class="mx_EventTile_button mx_EventTile_copyButton "></span></div>
</span>" </span>"
`; `;
exports[`<TextualBody /> renders formatted m.text correctly pills do not appear in code blocks 1`] = ` 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> "<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 <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> </code><span></span></pre><span class="mx_EventTile_button mx_EventTile_copyButton "></span></div>
</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>"`; 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]; const pins = () => [...localPins, ...nonLocalPins];
// Insert pin IDs into room state // Insert pin IDs into room state
mocked(room.currentState).getStateEvents.mockImplementation(() => mkEvent({ mocked(room.currentState).getStateEvents.mockImplementation((): any => mkEvent({
event: true, event: true,
type: EventType.RoomPinnedEvents, type: EventType.RoomPinnedEvents,
content: { content: {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -67,11 +67,9 @@ describe('notifications', () => {
it.each(deviceNotificationSettingsKeys)( it.each(deviceNotificationSettingsKeys)(
'unsilenced for existing sessions when %s setting is truthy', 'unsilenced for existing sessions when %s setting is truthy',
async (settingKey) => { async (settingKey) => {
mocked(SettingsStore) mocked(SettingsStore).getValue.mockImplementation((key): any => {
.getValue return key === settingKey;
.mockImplementation((key) => { });
return key === settingKey;
});
await createLocalNotificationSettingsIfNeeded(mockClient); await createLocalNotificationSettingsIfNeeded(mockClient);
const event = mockClient.getAccountData(accountDataEventKey); 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 === chunk1Event) return chunk1Helper;
if (event === chunk2Event) return chunk2Helper; if (event === chunk2Event) return chunk2Helper;
if (event === chunk3Event) return chunk3Helper; if (event === chunk3Event) return chunk3Helper;

View file

@ -130,15 +130,13 @@ describe("VoiceBroadcastRecording", () => {
mocked(createVoiceBroadcastRecorder).mockReturnValue(voiceBroadcastRecorder); mocked(createVoiceBroadcastRecorder).mockReturnValue(voiceBroadcastRecorder);
onChunkRecorded = jest.fn(); onChunkRecorded = jest.fn();
mocked(voiceBroadcastRecorder.on).mockImplementation( mocked(voiceBroadcastRecorder.on).mockImplementation((event: any, listener: any): VoiceBroadcastRecorder => {
(event: VoiceBroadcastRecorderEvent, listener: any): VoiceBroadcastRecorder => { if (event === VoiceBroadcastRecorderEvent.ChunkRecorded) {
if (event === VoiceBroadcastRecorderEvent.ChunkRecorded) { onChunkRecorded = listener;
onChunkRecorded = listener; }
}
return voiceBroadcastRecorder; return voiceBroadcastRecorder;
}, });
);
mocked(uploadFile).mockResolvedValue({ mocked(uploadFile).mockResolvedValue({
url: uploadedUrl, 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`] = ` 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] { [MockFunction] {
"calls": Array [ "calls": [
Array [ [
[Function], [Function],
Object { {
"description": <p> "description": <p>
Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one. Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.
</p>, </p>,
@ -14,8 +14,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
}, },
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "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`] = ` 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] { [MockFunction] {
"calls": Array [ "calls": [
Array [ [
[Function], [Function],
Object { {
"description": <p> "description": <p>
You are already recording a voice broadcast. Please end your current voice broadcast to start a new one. You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.
</p>, </p>,
@ -37,8 +37,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
}, },
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "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`] = ` 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] { [MockFunction] {
"calls": Array [ "calls": [
Array [ [
[Function], [Function],
Object { {
"description": <p> "description": <p>
You are already recording a voice broadcast. Please end your current voice broadcast to start a new one. You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.
</p>, </p>,
@ -60,8 +60,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
}, },
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "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`] = ` exports[`startNewVoiceBroadcastRecording when the current user is not allowed to send voice broadcast info state events should show an info dialog 1`] = `
[MockFunction] { [MockFunction] {
"calls": Array [ "calls": [
Array [ [
[Function], [Function],
Object { {
"description": <p> "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. You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.
</p>, </p>,
@ -83,8 +83,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is not allowed to
}, },
], ],
], ],
"results": Array [ "results": [
Object { {
"type": "return", "type": "return",
"value": undefined, "value": undefined,
}, },

View file

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

1482
yarn.lock

File diff suppressed because it is too large Load diff