element-web-Github/test/components/views/messages/__snapshots__/MLocationBody-test.tsx.snap

217 lines
6.7 KiB
Plaintext
Raw Normal View History

fallback to event text in location body when map unavailable (#7982) * center icon better Signed-off-by: Kerry Archibald <kerrya@element.io> * remove debug Signed-off-by: Kerry Archibald <kerrya@element.io> * retrigger all builds Signed-off-by: Kerry Archibald <kerrya@element.io> * set assetType on share event Signed-off-by: Kerry Archibald <kerrya@element.io> * use pin marker on map for pin drop share Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * test events Signed-off-by: Kerry Archibald <kerrya@element.io> * pin drop helper text Signed-off-by: Kerry Archibald <kerrya@element.io> * use generic location type Signed-off-by: Kerry Archibald <kerrya@element.io> * add navigationcontrol when in pin mode Signed-off-by: Kerry Archibald <kerrya@element.io> * allow pin drop without location permissions Signed-off-by: Kerry Archibald <kerrya@element.io> * remove geolocate control when pin dropping without geo perms Signed-off-by: Kerry Archibald <kerrya@element.io> * test locationpicker Signed-off-by: Kerry Archibald <kerrya@element.io> * test marker type, tidy Signed-off-by: Kerry Archibald <kerrya@element.io> * move findMapStyleUrl Signed-off-by: Kerry Archibald <kerrya@element.io> * fallback to event content when cant render map Signed-off-by: Kerry Archibald <kerrya@element.io> * update mocks in location picker, show same messages as timeline Signed-off-by: Kerry Archibald <kerrya@element.io> * style error message in location share menu Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * forgotten copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * add copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * update style Signed-off-by: Kerry Archibald <kerrya@element.io> * icon bigger Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-03-11 16:52:57 +08:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MLocationBody <MLocationBody> with error displays correct fallback content when map_style_url is misconfigured 1`] = `
<div
className="mx_EventTile_body mx_MLocationBody"
fallback to event text in location body when map unavailable (#7982) * center icon better Signed-off-by: Kerry Archibald <kerrya@element.io> * remove debug Signed-off-by: Kerry Archibald <kerrya@element.io> * retrigger all builds Signed-off-by: Kerry Archibald <kerrya@element.io> * set assetType on share event Signed-off-by: Kerry Archibald <kerrya@element.io> * use pin marker on map for pin drop share Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * test events Signed-off-by: Kerry Archibald <kerrya@element.io> * pin drop helper text Signed-off-by: Kerry Archibald <kerrya@element.io> * use generic location type Signed-off-by: Kerry Archibald <kerrya@element.io> * add navigationcontrol when in pin mode Signed-off-by: Kerry Archibald <kerrya@element.io> * allow pin drop without location permissions Signed-off-by: Kerry Archibald <kerrya@element.io> * remove geolocate control when pin dropping without geo perms Signed-off-by: Kerry Archibald <kerrya@element.io> * test locationpicker Signed-off-by: Kerry Archibald <kerrya@element.io> * test marker type, tidy Signed-off-by: Kerry Archibald <kerrya@element.io> * move findMapStyleUrl Signed-off-by: Kerry Archibald <kerrya@element.io> * fallback to event content when cant render map Signed-off-by: Kerry Archibald <kerrya@element.io> * update mocks in location picker, show same messages as timeline Signed-off-by: Kerry Archibald <kerrya@element.io> * style error message in location share menu Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * forgotten copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * add copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * update style Signed-off-by: Kerry Archibald <kerrya@element.io> * icon bigger Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-03-11 16:52:57 +08:00
>
<span
className="mx_EventTile_tileError"
>
Unable to load map: This homeserver is not configured correctly to display maps, or the configured map server may be unreachable.
</span>
<br />
Shared a location: Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000
</div>
`;
exports[`MLocationBody <MLocationBody> with error displays correct fallback content without error style when map_style_url is not configured 1`] = `
<div
className="mx_EventTile_body mx_MLocationBody"
fallback to event text in location body when map unavailable (#7982) * center icon better Signed-off-by: Kerry Archibald <kerrya@element.io> * remove debug Signed-off-by: Kerry Archibald <kerrya@element.io> * retrigger all builds Signed-off-by: Kerry Archibald <kerrya@element.io> * set assetType on share event Signed-off-by: Kerry Archibald <kerrya@element.io> * use pin marker on map for pin drop share Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * test events Signed-off-by: Kerry Archibald <kerrya@element.io> * pin drop helper text Signed-off-by: Kerry Archibald <kerrya@element.io> * use generic location type Signed-off-by: Kerry Archibald <kerrya@element.io> * add navigationcontrol when in pin mode Signed-off-by: Kerry Archibald <kerrya@element.io> * allow pin drop without location permissions Signed-off-by: Kerry Archibald <kerrya@element.io> * remove geolocate control when pin dropping without geo perms Signed-off-by: Kerry Archibald <kerrya@element.io> * test locationpicker Signed-off-by: Kerry Archibald <kerrya@element.io> * test marker type, tidy Signed-off-by: Kerry Archibald <kerrya@element.io> * move findMapStyleUrl Signed-off-by: Kerry Archibald <kerrya@element.io> * fallback to event content when cant render map Signed-off-by: Kerry Archibald <kerrya@element.io> * update mocks in location picker, show same messages as timeline Signed-off-by: Kerry Archibald <kerrya@element.io> * style error message in location share menu Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * forgotten copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * add copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * update style Signed-off-by: Kerry Archibald <kerrya@element.io> * icon bigger Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-03-11 16:52:57 +08:00
>
<span
className=""
>
Unable to load map: This homeserver is not configured to display maps.
</span>
<br />
Shared a location: Found at geo:51.5076,-0.1276 at 2021-12-21T12:22+0000
</div>
`;
exports[`MLocationBody <MLocationBody> without error renders map correctly 1`] = `
<MLocationBody
highlightLink=""
2022-11-04 18:48:08 +08:00
highlights={[]}
mediaEventHelper={{}}
mxEvent={
2022-11-04 18:48:08 +08:00
{
"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",
2022-11-04 18:48:08 +08:00
"org.matrix.msc3488.asset": {
"type": "m.pin",
},
2022-11-04 18:48:08 +08:00
"org.matrix.msc3488.location": {
"description": "Human-readable label",
"uri": "geo:51.5076,-0.1276",
},
"org.matrix.msc3488.ts": 252523,
},
"event_id": "$2",
"type": "org.matrix.msc3488.location",
}
}
onHeightChanged={[MockFunction]}
onMessageAllowed={[MockFunction]}
2022-11-04 18:48:08 +08:00
permalinkCreator={{}}
>
<LocationBodyContent
mapId="mx_MLocationBody_$2_HHHHHHHH"
mxEvent={
2022-11-04 18:48:08 +08:00
{
"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",
2022-11-04 18:48:08 +08:00
"org.matrix.msc3488.asset": {
"type": "m.pin",
},
2022-11-04 18:48:08 +08:00
"org.matrix.msc3488.location": {
"description": "Human-readable label",
"uri": "geo:51.5076,-0.1276",
},
"org.matrix.msc3488.ts": 252523,
},
"event_id": "$2",
"type": "org.matrix.msc3488.location",
}
}
onClick={[Function]}
onError={[Function]}
tooltip="Expand map"
>
<div
className="mx_MLocationBody"
>
<TooltipTarget
alignment={5}
label="Expand map"
maxParentWidth={450}
>
<div
onBlur={[Function]}
onFocus={[Function]}
onMouseLeave={[Function]}
onMouseMove={[Function]}
onMouseOver={[Function]}
tabIndex={0}
>
<Map
centerGeoUri="geo:51.5076,-0.1276"
className="mx_MLocationBody_map"
id="mx_MLocationBody_$2_HHHHHHHH"
onClick={[Function]}
onError={[Function]}
>
<div
className="mx_Map mx_MLocationBody_map"
id="mx_Map_mx_MLocationBody_$2_HHHHHHHH"
onClick={[Function]}
>
<SmartMarker
geoUri="geo:51.5076,-0.1276"
id="mx_MLocationBody_$2_HHHHHHHH-marker"
map={
MockMap {
2022-11-04 18:48:08 +08:00
"_events": {
"error": [
[Function],
[Function],
[Function],
[Function],
[Function],
[Function],
],
},
"_eventsCount": 1,
"_maxListeners": undefined,
"addControl": [MockFunction] {
2022-11-04 18:48:08 +08:00
"calls": [
[
mockConstructor {},
"top-right",
],
2022-11-04 18:48:08 +08:00
[
mockConstructor {},
"top-right",
],
],
2022-11-04 18:48:08 +08:00
"results": [
{
"type": "return",
"value": undefined,
},
2022-11-04 18:48:08 +08:00
{
"type": "return",
"value": undefined,
},
],
},
"fitBounds": [MockFunction],
"removeControl": [MockFunction],
"setCenter": [MockFunction] {
2022-11-04 18:48:08 +08:00
"calls": [
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
2022-11-04 18:48:08 +08:00
[
{
"lat": 51.5076,
"lon": -0.1276,
},
],
],
2022-11-04 18:48:08 +08:00
"results": [
{
"type": "return",
"value": undefined,
},
2022-11-04 18:48:08 +08:00
{
"type": "return",
"value": undefined,
},
],
},
"setStyle": [MockFunction],
"zoomIn": [MockFunction],
"zoomOut": [MockFunction],
Symbol(kCapture): false,
}
}
>
<span>
<ForwardRef
id="mx_MLocationBody_$2_HHHHHHHH-marker"
>
<div
className="mx_Marker mx_Marker_defaultColor"
id="mx_MLocationBody_$2_HHHHHHHH-marker"
>
<OptionalTooltip>
<div
className="mx_Marker_border"
>
<div
className="mx_Marker_icon"
/>
</div>
</OptionalTooltip>
</div>
</ForwardRef>
</span>
</SmartMarker>
</div>
</Map>
</div>
</TooltipTarget>
</div>
</LocationBodyContent>
</MLocationBody>
`;