MapWorkspace.tsx opened with ~590 lines of theme catalogue, dataset matching and label formatting above a 3.200-line component. None of it is React, all of it is independently testable, and both render paths read from it, so it belongs beside the pure helpers that already live in mapWorkspaceUtils. The contract tests that read MapWorkspace.tsx would have gone red for a move that changes no behaviour at all — 24 of them. That is the brittleness the frontend_contract helper exists to remove, so it gains read_map_workspace(): the workspace is one feature spread over several modules, and a contract belongs to the feature rather than to whichever file currently holds it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from tests.frontend_contract import read_map_workspace
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_map_workspace_exposes_feature_extract_actions() -> None:
|
|
map_workspace = read_map_workspace()
|
|
|
|
assert "Selectie en extractie" in map_workspace
|
|
assert "downloadSelectedMapFeature" in map_workspace
|
|
assert "copySelectedMapFeatureProperties" in map_workspace
|
|
assert "selected-feature.geojson" in map_workspace
|
|
assert "Geselecteerde GeoJSON downloaden" in map_workspace
|
|
assert "Eigenschappen kopiëren" in map_workspace
|
|
assert "Selectie wissen" in map_workspace
|
|
assert "featureGeometrySummary" in map_workspace
|
|
assert "featureExtractionEntries" in map_workspace
|
|
|
|
|
|
def test_geomap_highlights_selected_feature_layer() -> None:
|
|
geomap = (ROOT / "frontend" / "src" / "components" / "GeoMap.tsx").read_text(encoding="utf-8")
|
|
app = (ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8")
|
|
|
|
assert "selectedFeature?: GeoJSON.Feature | null" in geomap
|
|
assert "selected-feature" in geomap
|
|
assert "selected-feature-fill" in geomap
|
|
assert "selected-feature-line" in geomap
|
|
assert "selected-feature-circle" in geomap
|
|
assert "selectedFeature={selectedMapFeature}" in app
|
|
|
|
|
|
def test_feature_extract_css_is_responsive_and_scannable() -> None:
|
|
css = (ROOT / "frontend" / "src" / "styles" / "app.css").read_text(encoding="utf-8")
|
|
|
|
assert ".feature-extract-surface" in css
|
|
assert ".feature-extract-grid" in css
|
|
assert ".feature-extract-actions" in css
|
|
assert ".feature-property-table" in css
|
|
assert ".feature-extract-empty" in css
|
|
assert "grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));" in css
|