diff --git a/src/components/map/Handlers.test.tsx b/src/components/map/Handlers.test.tsx
index 343aa2f..8f32817 100644
--- a/src/components/map/Handlers.test.tsx
+++ b/src/components/map/Handlers.test.tsx
@@ -150,4 +150,97 @@ Arguments [
// screen.debug();
expect(transformMapParams).toBeUndefined();
});
+
+ test('throttle mouseMove events', () => {
+ var transformMapParams: any;
+ function transformMap(
+ deltaShift: Point | null,
+ deltaZoom: number | null,
+ zoomCenter: Point | null
+ ) {
+ console.log(`transformMap${JSON.stringify(arguments)}`);
+ transformMapParams = arguments;
+ }
+ render();
+ const handlers = screen.getByRole('presentation');
+ fireEvent(
+ handlers,
+ createEvent.mouseDown(handlers, {
+ clientX: 10,
+ clientY: 20,
+ })
+ );
+ fireEvent(
+ handlers,
+ createEvent.mouseMove(handlers, {
+ clientX: 20,
+ clientY: 50,
+ })
+ );
+ fireEvent(
+ handlers,
+ createEvent.mouseMove(handlers, {
+ clientX: 30,
+ clientY: 60,
+ })
+ );
+ // screen.debug();
+ expect(transformMapParams).toMatchInlineSnapshot(`
+Arguments [
+ Object {
+ "x": 10,
+ "y": 30,
+ },
+ null,
+ null,
+]
+`);
+ });
+
+ test('throttle mouseMove events', async () => {
+ var transformMapParams: any;
+ function transformMap(
+ deltaShift: Point | null,
+ deltaZoom: number | null,
+ zoomCenter: Point | null
+ ) {
+ console.log(`transformMap${JSON.stringify(arguments)}`);
+ transformMapParams = arguments;
+ }
+ render();
+ const handlers = screen.getByRole('presentation');
+ fireEvent(
+ handlers,
+ createEvent.mouseDown(handlers, {
+ clientX: 10,
+ clientY: 20,
+ })
+ );
+ fireEvent(
+ handlers,
+ createEvent.mouseMove(handlers, {
+ clientX: 20,
+ clientY: 50,
+ })
+ );
+ await new Promise((r) => setTimeout(r, 500));
+ fireEvent(
+ handlers,
+ createEvent.mouseMove(handlers, {
+ clientX: 5,
+ clientY: 5,
+ })
+ );
+ // screen.debug();
+ expect(transformMapParams).toMatchInlineSnapshot(`
+Arguments [
+ Object {
+ "x": -15,
+ "y": -45,
+ },
+ null,
+ null,
+]
+`);
+ });
});