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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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