Live location sharing - beacon in timeline happy path (#8285)
* extract location markers into generic Marker Signed-off-by: Kerry Archibald <kerrya@element.io> * wrap marker in smartmarker Signed-off-by: Kerry Archibald <kerrya@element.io> * test smartmarker Signed-off-by: Kerry Archibald <kerrya@element.io> * working map in location body Signed-off-by: Kerry Archibald <kerrya@element.io> * remove skinned sdk Signed-off-by: Kerry Archibald <kerrya@element.io> * use new ZoomButtons in MLocationBody Signed-off-by: Kerry Archibald <kerrya@element.io> * test LocationViewDialog Signed-off-by: Kerry Archibald <kerrya@element.io> * update commentt Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * extract livetimeremaining into own component Signed-off-by: Kerry Archibald <kerrya@element.io> * extract more beacon state utils Signed-off-by: Kerry Archibald <kerrya@element.io> * update tests for roomlivesharewarning Signed-off-by: Kerry Archibald <kerrya@element.io> * add idle status to live beacon icon * add beacon map and status chin Signed-off-by: Kerry Archibald <kerrya@element.io> * add handling for bubbles Signed-off-by: Kerry Archibald <kerrya@element.io> * tests for BeaconBody Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * move displaystatus check up to mbeaconbody Signed-off-by: Kerry Archibald <kerrya@element.io> * test BeaconStatus Signed-off-by: Kerry Archibald <kerrya@element.io> * rename BeaconStatusChin -> BeaconStatus Signed-off-by: Kerry Archibald <kerrya@element.io> * make BeaconStatus generic Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * adjust spinner size Signed-off-by: Kerry Archibald <kerrya@element.io> * polish and copyrights Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * better comment Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
b4a91ea442
commit
e59edb7101
22 changed files with 562 additions and 91 deletions
67
test/components/views/beacon/BeaconStatus-test.tsx
Normal file
67
test/components/views/beacon/BeaconStatus-test.tsx
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { Beacon } from 'matrix-js-sdk/src/matrix';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import BeaconStatus from '../../../../src/components/views/beacon/BeaconStatus';
|
||||
import { BeaconDisplayStatus } from '../../../../src/components/views/beacon/displayStatus';
|
||||
import { findByTestId, makeBeaconInfoEvent } from '../../../test-utils';
|
||||
|
||||
describe('<BeaconStatus />', () => {
|
||||
const defaultProps = {
|
||||
displayStatus: BeaconDisplayStatus.Loading,
|
||||
};
|
||||
const getComponent = (props = {}) =>
|
||||
mount(<BeaconStatus {...defaultProps} {...props} />);
|
||||
|
||||
it('renders loading state', () => {
|
||||
const component = getComponent({ displayStatus: BeaconDisplayStatus.Loading });
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders stopped state', () => {
|
||||
const component = getComponent({ displayStatus: BeaconDisplayStatus.Stopped });
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders active state without stop buttons', () => {
|
||||
// mock for stable snapshot
|
||||
jest.spyOn(Date, 'now').mockReturnValue(123456789);
|
||||
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:server', {}, '$1'));
|
||||
const component = getComponent({ beacon, displayStatus: BeaconDisplayStatus.Active });
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders active state with stop button', () => {
|
||||
const stopBeacon = jest.fn();
|
||||
const beacon = new Beacon(makeBeaconInfoEvent('@user:server', '!room:sever'));
|
||||
const component = getComponent({
|
||||
beacon,
|
||||
stopBeacon,
|
||||
displayStatus: BeaconDisplayStatus.Active,
|
||||
});
|
||||
expect(findByTestId(component, 'beacon-status-stop-beacon')).toMatchSnapshot();
|
||||
|
||||
act(() => {
|
||||
findByTestId(component, 'beacon-status-stop-beacon').at(0).simulate('click');
|
||||
});
|
||||
|
||||
expect(stopBeacon).toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -100,7 +100,7 @@ describe('<RoomLiveShareWarning />', () => {
|
|||
});
|
||||
|
||||
afterEach(async () => {
|
||||
jest.spyOn(OwnBeaconStore.instance, 'hasWireErrors').mockRestore();
|
||||
jest.spyOn(OwnBeaconStore.instance, 'beaconHasWireError').mockRestore();
|
||||
await resetAsyncStoreWithClient(OwnBeaconStore.instance);
|
||||
});
|
||||
|
||||
|
@ -319,20 +319,24 @@ describe('<RoomLiveShareWarning />', () => {
|
|||
|
||||
describe('with wire errors', () => {
|
||||
it('displays wire error when mounted with wire errors', async () => {
|
||||
const hasWireErrorsSpy = jest.spyOn(OwnBeaconStore.instance, 'hasWireErrors').mockReturnValue(true);
|
||||
const wireErrorSpy = jest.spyOn(OwnBeaconStore.instance, 'beaconHasWireError')
|
||||
.mockReturnValue(true);
|
||||
const component = getComponent({ roomId: room2Id });
|
||||
|
||||
expect(component).toMatchSnapshot();
|
||||
expect(hasWireErrorsSpy).toHaveBeenCalledWith(room2Id);
|
||||
expect(wireErrorSpy).toHaveBeenCalledWith(
|
||||
getBeaconInfoIdentifier(room2Beacon1), 0, [getBeaconInfoIdentifier(room2Beacon1)],
|
||||
);
|
||||
});
|
||||
|
||||
it('displays wire error when wireError event is emitted and beacons have errors', async () => {
|
||||
const hasWireErrorsSpy = jest.spyOn(OwnBeaconStore.instance, 'hasWireErrors').mockReturnValue(false);
|
||||
const wireErrorSpy = jest.spyOn(OwnBeaconStore.instance, 'beaconHasWireError')
|
||||
.mockReturnValue(false);
|
||||
const component = getComponent({ roomId: room2Id });
|
||||
|
||||
// update mock and emit event
|
||||
act(() => {
|
||||
hasWireErrorsSpy.mockReturnValue(true);
|
||||
wireErrorSpy.mockReturnValue(true);
|
||||
OwnBeaconStore.instance.emit(OwnBeaconStoreEvent.WireError, getBeaconInfoIdentifier(room2Beacon1));
|
||||
});
|
||||
component.setProps({});
|
||||
|
@ -345,12 +349,13 @@ describe('<RoomLiveShareWarning />', () => {
|
|||
});
|
||||
|
||||
it('stops displaying wire error when errors are cleared', async () => {
|
||||
const hasWireErrorsSpy = jest.spyOn(OwnBeaconStore.instance, 'hasWireErrors').mockReturnValue(true);
|
||||
const wireErrorSpy = jest.spyOn(OwnBeaconStore.instance, 'beaconHasWireError')
|
||||
.mockReturnValue(true);
|
||||
const component = getComponent({ roomId: room2Id });
|
||||
|
||||
// update mock and emit event
|
||||
act(() => {
|
||||
hasWireErrorsSpy.mockReturnValue(false);
|
||||
wireErrorSpy.mockReturnValue(false);
|
||||
OwnBeaconStore.instance.emit(OwnBeaconStoreEvent.WireError, getBeaconInfoIdentifier(room2Beacon1));
|
||||
});
|
||||
component.setProps({});
|
||||
|
@ -363,7 +368,7 @@ describe('<RoomLiveShareWarning />', () => {
|
|||
});
|
||||
|
||||
it('clicking retry button resets wire errors', async () => {
|
||||
jest.spyOn(OwnBeaconStore.instance, 'hasWireErrors').mockReturnValue(true);
|
||||
jest.spyOn(OwnBeaconStore.instance, 'beaconHasWireError').mockReturnValue(true);
|
||||
const resetErrorSpy = jest.spyOn(OwnBeaconStore.instance, 'resetWireError');
|
||||
|
||||
const component = getComponent({ roomId: room2Id });
|
||||
|
@ -376,7 +381,7 @@ describe('<RoomLiveShareWarning />', () => {
|
|||
});
|
||||
|
||||
it('clicking close button stops beacons', async () => {
|
||||
jest.spyOn(OwnBeaconStore.instance, 'hasWireErrors').mockReturnValue(true);
|
||||
jest.spyOn(OwnBeaconStore.instance, 'beaconHasWireError').mockReturnValue(true);
|
||||
const stopBeaconSpy = jest.spyOn(OwnBeaconStore.instance, 'stopBeacon');
|
||||
|
||||
const component = getComponent({ roomId: room2Id });
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<BeaconStatus /> renders active state with stop button 1`] = `
|
||||
Array [
|
||||
<AccessibleButton
|
||||
className="mx_BeaconStatus_stopButton"
|
||||
data-test-id="beacon-status-stop-beacon"
|
||||
element="div"
|
||||
kind="link"
|
||||
onClick={[MockFunction]}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
<div
|
||||
className="mx_AccessibleButton mx_BeaconStatus_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link"
|
||||
data-test-id="beacon-status-stop-beacon"
|
||||
onClick={[MockFunction]}
|
||||
onKeyDown={[Function]}
|
||||
onKeyUp={[Function]}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
Stop
|
||||
</div>
|
||||
</AccessibleButton>,
|
||||
<div
|
||||
className="mx_AccessibleButton mx_BeaconStatus_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link"
|
||||
data-test-id="beacon-status-stop-beacon"
|
||||
onClick={[MockFunction]}
|
||||
onKeyDown={[Function]}
|
||||
onKeyUp={[Function]}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
Stop
|
||||
</div>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`<BeaconStatus /> renders active state without stop buttons 1`] = `
|
||||
<BeaconStatus
|
||||
beacon={
|
||||
Beacon {
|
||||
"_beaconInfo": Object {
|
||||
"assetType": "m.self",
|
||||
"description": undefined,
|
||||
"live": undefined,
|
||||
"timeout": 3600000,
|
||||
"timestamp": 123456789,
|
||||
},
|
||||
"_events": Object {
|
||||
"Beacon.update": [Function],
|
||||
},
|
||||
"_eventsCount": 1,
|
||||
"_isLive": undefined,
|
||||
"_latestLocationState": undefined,
|
||||
"_maxListeners": undefined,
|
||||
"clearLatestLocation": [Function],
|
||||
"livenessWatchInterval": undefined,
|
||||
"roomId": "!room:server",
|
||||
"rootEvent": Object {
|
||||
"content": Object {
|
||||
"description": undefined,
|
||||
"live": undefined,
|
||||
"org.matrix.msc3488.asset": Object {
|
||||
"type": "m.self",
|
||||
},
|
||||
"org.matrix.msc3488.ts": 123456789,
|
||||
"timeout": 3600000,
|
||||
},
|
||||
"event_id": "$1",
|
||||
"origin_server_ts": 123456789,
|
||||
"room_id": "!room:server",
|
||||
"sender": "@user:server",
|
||||
"state_key": "@user:server",
|
||||
"type": "org.matrix.msc3672.beacon_info",
|
||||
},
|
||||
Symbol(kCapture): false,
|
||||
}
|
||||
}
|
||||
displayStatus="Active"
|
||||
>
|
||||
<div
|
||||
className="mx_BeaconStatus mx_BeaconStatus_Active"
|
||||
>
|
||||
<StyledLiveBeaconIcon
|
||||
className="mx_BeaconStatus_icon"
|
||||
isIdle={false}
|
||||
withError={false}
|
||||
>
|
||||
<div
|
||||
className="mx_StyledLiveBeaconIcon mx_BeaconStatus_icon"
|
||||
/>
|
||||
</StyledLiveBeaconIcon>
|
||||
<div
|
||||
className="mx_BeaconStatus_activeDescription"
|
||||
>
|
||||
<LiveTimeRemaining
|
||||
beacon={
|
||||
Beacon {
|
||||
"_beaconInfo": Object {
|
||||
"assetType": "m.self",
|
||||
"description": undefined,
|
||||
"live": undefined,
|
||||
"timeout": 3600000,
|
||||
"timestamp": 123456789,
|
||||
},
|
||||
"_events": Object {
|
||||
"Beacon.update": [Function],
|
||||
},
|
||||
"_eventsCount": 1,
|
||||
"_isLive": undefined,
|
||||
"_latestLocationState": undefined,
|
||||
"_maxListeners": undefined,
|
||||
"clearLatestLocation": [Function],
|
||||
"livenessWatchInterval": undefined,
|
||||
"roomId": "!room:server",
|
||||
"rootEvent": Object {
|
||||
"content": Object {
|
||||
"description": undefined,
|
||||
"live": undefined,
|
||||
"org.matrix.msc3488.asset": Object {
|
||||
"type": "m.self",
|
||||
},
|
||||
"org.matrix.msc3488.ts": 123456789,
|
||||
"timeout": 3600000,
|
||||
},
|
||||
"event_id": "$1",
|
||||
"origin_server_ts": 123456789,
|
||||
"room_id": "!room:server",
|
||||
"sender": "@user:server",
|
||||
"state_key": "@user:server",
|
||||
"type": "org.matrix.msc3672.beacon_info",
|
||||
},
|
||||
Symbol(kCapture): false,
|
||||
}
|
||||
}
|
||||
>
|
||||
<span
|
||||
className="mx_LiveTimeRemaining"
|
||||
data-test-id="room-live-share-expiry"
|
||||
>
|
||||
1h left
|
||||
</span>
|
||||
</LiveTimeRemaining>
|
||||
</div>
|
||||
</div>
|
||||
</BeaconStatus>
|
||||
`;
|
||||
|
||||
exports[`<BeaconStatus /> renders loading state 1`] = `
|
||||
<BeaconStatus
|
||||
displayStatus="Loading"
|
||||
>
|
||||
<div
|
||||
className="mx_BeaconStatus mx_BeaconStatus_Loading"
|
||||
>
|
||||
<StyledLiveBeaconIcon
|
||||
className="mx_BeaconStatus_icon"
|
||||
isIdle={true}
|
||||
withError={false}
|
||||
>
|
||||
<div
|
||||
className="mx_StyledLiveBeaconIcon mx_BeaconStatus_icon mx_StyledLiveBeaconIcon_idle"
|
||||
/>
|
||||
</StyledLiveBeaconIcon>
|
||||
<span>
|
||||
Loading live location...
|
||||
</span>
|
||||
</div>
|
||||
</BeaconStatus>
|
||||
`;
|
||||
|
||||
exports[`<BeaconStatus /> renders stopped state 1`] = `
|
||||
<BeaconStatus
|
||||
displayStatus="Stopped"
|
||||
>
|
||||
<div
|
||||
className="mx_BeaconStatus mx_BeaconStatus_Stopped"
|
||||
>
|
||||
<StyledLiveBeaconIcon
|
||||
className="mx_BeaconStatus_icon"
|
||||
isIdle={true}
|
||||
withError={false}
|
||||
>
|
||||
<div
|
||||
className="mx_StyledLiveBeaconIcon mx_BeaconStatus_icon mx_StyledLiveBeaconIcon_idle"
|
||||
/>
|
||||
</StyledLiveBeaconIcon>
|
||||
<span>
|
||||
Live location ended
|
||||
</span>
|
||||
</div>
|
||||
</BeaconStatus>
|
||||
`;
|
|
@ -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_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Stop sharing</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 sharing</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_AccessibleButton_hasKind mx_AccessibleButton_kind_danger\\">Stop sharing</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 sharing</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_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 wire errors displays wire error when mounted with wire errors 1`] = `
|
||||
<RoomLiveShareWarning
|
||||
|
@ -35,6 +35,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
|
|||
An error occured whilst sharing your live location, please try again
|
||||
</span>
|
||||
<AccessibleButton
|
||||
className="mx_RoomLiveShareWarning_stopButton"
|
||||
data-test-id="room-live-share-primary-button"
|
||||
disabled={false}
|
||||
element="button"
|
||||
|
@ -44,7 +45,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
|
|||
tabIndex={0}
|
||||
>
|
||||
<button
|
||||
className="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger"
|
||||
className="mx_AccessibleButton mx_RoomLiveShareWarning_stopButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_danger"
|
||||
data-test-id="room-live-share-primary-button"
|
||||
onClick={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
|
|
|
@ -95,7 +95,7 @@ describe('<MBeaconBody />', () => {
|
|||
);
|
||||
makeRoomWithStateEvents([beaconInfoEvent]);
|
||||
const component = getComponent({ mxEvent: beaconInfoEvent });
|
||||
expect(component.find('Map').length).toBeFalsy();
|
||||
expect(component.text()).toEqual("Live location ended");
|
||||
});
|
||||
|
||||
it('renders stopped beacon UI for an expired beacon', () => {
|
||||
|
@ -107,7 +107,7 @@ describe('<MBeaconBody />', () => {
|
|||
);
|
||||
makeRoomWithStateEvents([beaconInfoEvent]);
|
||||
const component = getComponent({ mxEvent: beaconInfoEvent });
|
||||
expect(component.find('Map').length).toBeFalsy();
|
||||
expect(component.text()).toEqual("Live location ended");
|
||||
});
|
||||
|
||||
it('renders stopped UI when a beacon event is not the latest beacon for a user', () => {
|
||||
|
@ -130,7 +130,7 @@ describe('<MBeaconBody />', () => {
|
|||
|
||||
const component = getComponent({ mxEvent: aliceBeaconInfo1 });
|
||||
// beacon1 has been superceded by beacon2
|
||||
expect(component.find('Map').length).toBeFalsy();
|
||||
expect(component.text()).toEqual("Live location ended");
|
||||
});
|
||||
|
||||
it('renders stopped UI when a beacon event is replaced', () => {
|
||||
|
@ -162,7 +162,7 @@ describe('<MBeaconBody />', () => {
|
|||
component.setProps({});
|
||||
|
||||
// beacon1 has been superceded by beacon2
|
||||
expect(component.find('Map').length).toBeFalsy();
|
||||
expect(component.text()).toEqual("Live location ended");
|
||||
});
|
||||
|
||||
describe('on liveness change', () => {
|
||||
|
@ -187,7 +187,7 @@ describe('<MBeaconBody />', () => {
|
|||
component.setProps({});
|
||||
|
||||
// stopped UI
|
||||
expect(component.find('Map').length).toBeFalsy();
|
||||
expect(component.text()).toEqual("Live location ended");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -210,7 +210,7 @@ describe('<MBeaconBody />', () => {
|
|||
makeRoomWithStateEvents([aliceBeaconInfo]);
|
||||
const component = getComponent({ mxEvent: aliceBeaconInfo });
|
||||
|
||||
expect(component.find('Spinner').length).toBeTruthy();
|
||||
expect(component.text()).toEqual("Loading live location...");
|
||||
});
|
||||
|
||||
it('updates latest location', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue