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:
Kerry 2022-04-13 10:44:15 +02:00 committed by GitHub
parent b4a91ea442
commit e59edb7101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 562 additions and 91 deletions

View file

@ -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 });