perf(monitor): synchronize map follow frames
This commit is contained in:
@@ -14,6 +14,7 @@ const markerSetMap = vi.fn();
|
||||
const markerSetPosition = vi.fn();
|
||||
const labelSetPosition = vi.fn();
|
||||
const setZoomAndCenter = vi.fn();
|
||||
const setCenter = vi.fn();
|
||||
const panTo = vi.fn();
|
||||
const mapOff = vi.fn();
|
||||
const mapDestroy = vi.fn();
|
||||
@@ -45,6 +46,7 @@ class TestMap {
|
||||
getZoom = getZoom;
|
||||
getBounds = getBounds;
|
||||
setZoomAndCenter = setZoomAndCenter;
|
||||
setCenter = setCenter;
|
||||
panTo = panTo;
|
||||
}
|
||||
|
||||
@@ -231,6 +233,7 @@ afterEach(() => {
|
||||
markerSetPosition.mockReset();
|
||||
labelSetPosition.mockReset();
|
||||
setZoomAndCenter.mockReset();
|
||||
setCenter.mockReset();
|
||||
panTo.mockReset();
|
||||
mapOff.mockReset();
|
||||
mapDestroy.mockReset();
|
||||
@@ -467,7 +470,8 @@ test('renders one selected plate and smoothly follows it until the map is dragge
|
||||
/>
|
||||
);
|
||||
await waitFor(() => expect(markerSetPosition).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14)), { timeout: 1_800 });
|
||||
expect(panTo).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14), 10_000);
|
||||
expect(setCenter).toHaveBeenLastCalledWith(wgs84ToGcj02(113.27, 23.14));
|
||||
expect(panTo).not.toHaveBeenCalled();
|
||||
expect(setZoomAndCenter).toHaveBeenCalledTimes(1);
|
||||
|
||||
const follow = screen.getByRole('button', { name: '跟随车辆' });
|
||||
|
||||
Reference in New Issue
Block a user