fix(map): restore subject flight and search inset

This commit is contained in:
Codex
2026-08-09 15:06:11 +03:00
parent beb84f6de6
commit 71c1528b83
5 changed files with 65 additions and 9 deletions
+8 -1
View File
@@ -108,11 +108,18 @@ test("facet tree selection focuses the subject without resetting a compatible de
assert.match(preview, /const \[expandedFacetRows, setExpandedFacetRows\]/);
assert.match(preview, /const handleSelectAndFocus = useCallback/);
assert.match(preview, /mapRendererRef\.current\?\.focusRuntimeEntity\(entityId\)/);
assert.match(preview, /const focusSubject = useCallback/);
assert.match(preview, /if \(renderer\.focusRuntimeEntity\(entityId\)\) return true/);
assert.match(preview, /mapFactPointCoordinates\(selectable\.find/);
assert.match(preview, /renderer\.focusSubjectCoordinates\(fallbackCoordinates\[0\], fallbackCoordinates\[1\]\)/);
assert.match(preview, /focusSubject\(entityId\)/);
assert.match(preview, /focusSubject\(result\.entityId, result\.coordinates\)/);
assert.match(preview, /setSubjectCardTabId\(\(current\) =>/);
assert.match(preview, /profile\?\.tabs\.some\(\(tab\) => tab\.id === current\)/);
assert.match(preview, /\(profile\?\.defaultTabId \?\? "overview"\)/);
assert.match(renderer, /void viewer\.flyTo\(entity, \{/);
assert.match(renderer, /const focusSubjectCoordinates = useCallback/);
assert.match(renderer, /viewer\.camera\.flyToBoundingSphere\(new BoundingSphere\(target, 1\), \{/);
assert.match(renderer, /duration: 0\.45/);
assert.match(renderer, /offset: new HeadingPitchRange\(0, -0\.9, 8_000\)/);
});
+11
View File
@@ -1,6 +1,8 @@
import assert from "node:assert/strict";
import test from "node:test";
import { readFile } from "node:fs/promises";
import { buildMapSearchIndex, searchMapSubjects } from "../apps/catalog/src/mapSearch.mjs";
const now = "2026-07-25T08:00:00.000Z";
@@ -101,3 +103,12 @@ test("reference subjects remain searchable by profile labels without a provider
assert.equal(searchMapSubjects(index, "osm.node.1").at(0)?.groupTitle, "Метро");
assert.deepEqual(searchMapSubjects(index, "provider_note"), []);
});
test("expanded search keeps the canonical toolbar inset on every edge", async () => {
const styles = await readFile(new URL("../apps/catalog/src/styles.css", import.meta.url), "utf8");
const baseToolbar = styles.match(/\.catalog-map-fixture__toolbar\s*\{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
const expandedToolbar = styles.match(/\.catalog-map-fixture__toolbar\[data-search-open\]\s*\{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
assert.match(baseToolbar, /padding: 0\.4rem/);
assert.doesNotMatch(expandedToolbar, /padding-right:\s*0/);
});