feat: add project-aware agent workspace
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { renderHook } from "@testing-library/react";
|
||||
import type { Map as MapLibreMap } from "maplibre-gl";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
useMapInteractions,
|
||||
clearMapFeatureInteractionState,
|
||||
isPointOccludedByCityBuilding,
|
||||
setMapFeatureInteractionState,
|
||||
@@ -71,3 +74,17 @@ describe("map feature interaction state", () => {
|
||||
expect(queryRenderedFeatures).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("suspends feature picking while the map is used to look up a place", () => {
|
||||
const canvas = document.createElement("canvas");
|
||||
const map = { on: vi.fn(), off: vi.fn(), getLayer: vi.fn(() => ({})), getCanvas: () => canvas };
|
||||
const props = { enabled: false, mapRef: { current: map as unknown as MapLibreMap },
|
||||
availableSourceIds: ["pipes"] as const, mapReady: true, onSelectFeature: vi.fn(), selectedFeature: null };
|
||||
const { rerender } = renderHook(useMapInteractions, { initialProps: props });
|
||||
expect(map.on).not.toHaveBeenCalled();
|
||||
rerender({ ...props, enabled: true });
|
||||
expect(map.on).toHaveBeenCalledWith("click", expect.any(Array), expect.any(Function));
|
||||
rerender(props);
|
||||
expect(map.off).toHaveBeenCalledWith("click", expect.any(Array), expect.any(Function));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user