test(workbench): add browser regression coverage

This commit is contained in:
que01 committed 2026-09-02 17:39:25 +08:00
1 parent 2fb9db65e5
commit fcb07b8396
6 files changed
+230 -1

No files matched your search

@@ -238,6 +238,9 @@ export function MapCanvas({
view: new View({ center: [0, 0], zoom: 2 }),
});
mapRef.current = map;
// Non-visual probe for browser regression tests; production interactions still
// go through OpenLayers and the normal pointer handlers below.
(target.current as HTMLDivElement & { __roadWorkbenchMap?: Map }).__roadWorkbenchMap = map;
const select = new Select({
condition: click,
// Handles are not selectable features: clicking one must not re-target the
@@ -396,6 +399,7 @@ export function MapCanvas({
return () => {
select.un('select', listener);
map.setTarget(undefined);
delete (target.current as HTMLDivElement & { __roadWorkbenchMap?: Map })?.__roadWorkbenchMap;
};
// Map construction must be once per mounted canvas; state changes update sources below.
// eslint-disable-next-line react-hooks/exhaustive-deps