1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-06 10:22:45 +03:00

Live location share - link to timeline tile from share warning (PSF-1078) (#8752)

* navigate to live location tile from left panel live warning

Signed-off-by: Kerry Archibald <kerrya@element.io>

* navigate to beacon tile from room live share warning

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add cursor

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry
2022-06-07 12:15:09 +02:00
committed by GitHub
parent f65e8d088e
commit 56b0b79fb7
6 changed files with 67 additions and 11 deletions

View File

@@ -126,6 +126,9 @@ describe('<LeftPanelLiveShareWarning />', () => {
metricsTrigger: undefined,
// latest beacon's room
room_id: roomId2,
event_id: beacon2.beaconInfoId,
highlighted: true,
scroll_into_view: true,
});
});
@@ -158,6 +161,9 @@ describe('<LeftPanelLiveShareWarning />', () => {
metricsTrigger: undefined,
// error beacon's room
room_id: roomId1,
event_id: beacon1.beaconInfoId,
highlighted: true,
scroll_into_view: true,
});
});
@@ -264,6 +270,9 @@ describe('<LeftPanelLiveShareWarning />', () => {
metricsTrigger: undefined,
// stopping error beacon's room
room_id: beacon2.roomId,
event_id: beacon2.beaconInfoId,
highlighted: true,
scroll_into_view: true,
});
});
});

View File

@@ -32,6 +32,8 @@ import {
resetAsyncStoreWithClient,
setupAsyncStoreWithClient,
} from '../../../test-utils';
import defaultDispatcher from '../../../../src/dispatcher/dispatcher';
import { Action } from '../../../../src/dispatcher/actions';
jest.useFakeTimers();
describe('<RoomLiveShareWarning />', () => {
@@ -117,6 +119,7 @@ describe('<RoomLiveShareWarning />', () => {
afterAll(() => {
jest.spyOn(global.Date, 'now').mockRestore();
localStorageSpy.mockRestore();
jest.spyOn(defaultDispatcher, 'dispatch').mockRestore();
});
const getExpiryText = wrapper => findByTestId(wrapper, 'room-live-share-expiry').text();
@@ -263,6 +266,24 @@ describe('<RoomLiveShareWarning />', () => {
expect(clearIntervalSpy).toHaveBeenCalled();
});
it('navigates to beacon tile on click', () => {
const dispatcherSpy = jest.spyOn(defaultDispatcher, 'dispatch');
const component = getComponent({ roomId: room1Id });
act(() => {
component.simulate('click');
});
expect(dispatcherSpy).toHaveBeenCalledWith({
action: Action.ViewRoom,
event_id: room1Beacon1.getId(),
room_id: room1Id,
highlighted: true,
scroll_into_view: true,
metricsTrigger: undefined,
});
});
describe('stopping beacons', () => {
it('stops beacon on stop sharing click', () => {
const component = getComponent({ roomId: room2Id });

View File

@@ -20,6 +20,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
>
<div
className="mx_RoomLiveShareWarning"
onClick={[Function]}
>
<StyledLiveBeaconIcon
className="mx_RoomLiveShareWarning_icon"