feat(monitor): preserve investigation context
This commit is contained in:
@@ -296,6 +296,29 @@ test('recovers in place after a transient AMap failure and renders data that arr
|
||||
expect(screen.queryByText(/地图加载失败/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('restores the saved monitor viewport without forcing the selected vehicle zoom', async () => {
|
||||
window.__LINGNIU_APP_CONFIG__ = { amapWebJsKey: 'amap-web-key' };
|
||||
window.AMapLoader = { load: vi.fn(async () => amapMock()) };
|
||||
const bounds = '113.100000,23.000000,113.400000,23.300000';
|
||||
|
||||
render(<FleetMap
|
||||
vehicles={[]}
|
||||
monitorMap={pointMap}
|
||||
selectedVin="LTEST000000000001"
|
||||
initialViewport={{ zoom: 13, bounds }}
|
||||
onSelect={() => undefined}
|
||||
/>);
|
||||
|
||||
await waitFor(() => expect(mapOptions).toHaveLength(1));
|
||||
expect(mapOptions[0]).toEqual(expect.objectContaining({
|
||||
zoom: 13,
|
||||
center: wgs84ToGcj02(113.25, 23.15)
|
||||
}));
|
||||
await waitFor(() => expect(markerSetMap).toHaveBeenCalled());
|
||||
expect(setZoomAndCenter).not.toHaveBeenCalled();
|
||||
expect(panTo).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('detaches AMap listeners and destroys the map on unmount', async () => {
|
||||
window.__LINGNIU_APP_CONFIG__ = { amapWebJsKey: 'amap-web-key' };
|
||||
window.AMapLoader = { load: vi.fn(async () => amapMock()) };
|
||||
|
||||
Reference in New Issue
Block a user