feat(map): refine sector inspector styling

This commit is contained in:
Codex
2026-08-06 12:10:26 +03:00
parent d4827009d4
commit e8729401fd
11 changed files with 437 additions and 26 deletions
+42
View File
@@ -15,6 +15,11 @@ const extensionKeys = [
"volumeMinimumHeightMeters",
"volumeMaximumHeightMeters",
"volumeBandHeightMeters",
"selectionFillColor",
"selectionFillOpacityPercent",
"selectionOutlineColor",
"selectionOutlineWidthPx",
"selectionOutlineOpacityPercent",
];
function applicationError(code, statusCode = 400) {
@@ -96,3 +101,40 @@ test("flat layouts migrate mode-aware extensions while explicit invalid hierarch
test("Foundry MCP exposes every persisted sector-v2 profile field", () => {
for (const key of extensionKeys) assert.match(mcpSource, new RegExp(`\\b${key}: \\{`));
});
test("server persists selected-sector visuals and accepts a 1,000 m address band inside its range", () => {
const profiles = structuredClone(DEFAULT_GRID_LOD_PROFILES);
Object.assign(profiles[0], {
volumeMaximumHeightMeters: 1_000,
volumeBandHeightMeters: 1_000,
selectionFillColor: "#A0B1C2",
selectionFillOpacityPercent: 34,
selectionOutlineColor: "#C3D4E5",
selectionOutlineWidthPx: 7.5,
selectionOutlineOpacityPercent: 81,
});
const validated = structuredClone(serverGrid.validateGridLodProfiles(profiles));
assert.equal(validated[0].volumeBandHeightMeters, 1_000);
assert.equal(validated[0].selectionFillColor, "#a0b1c2");
assert.equal(validated[0].selectionFillOpacityPercent, 34);
assert.equal(validated[0].selectionOutlineColor, "#c3d4e5");
assert.equal(validated[0].selectionOutlineWidthPx, 7.5);
assert.equal(validated[0].selectionOutlineOpacityPercent, 81);
});
test("server rejects selected-sector visual values outside the canonical bounds", () => {
for (const [field, value] of [
["selectionFillColor", "cyan"],
["selectionFillOpacityPercent", 101],
["selectionOutlineColor", "#ffff"],
["selectionOutlineWidthPx", 12.01],
["selectionOutlineOpacityPercent", -1],
]) {
const profiles = structuredClone(DEFAULT_GRID_LOD_PROFILES);
profiles[0][field] = value;
assert.throws(
() => serverGrid.validateGridLodProfiles(profiles),
new RegExp(`invalid_map_grid_lod_profile_1_${field}`),
);
}
});