from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def test_change_detection_panel_exposes_structured_surfaces() -> None: panel = (ROOT / "frontend" / "src" / "components" / "analysis" / "ChangeDetectionPanel.tsx").read_text( encoding="utf-8" ) assert 'className="panel change-detection-shell"' in panel assert 'className="panel-header change-detection-heading"' in panel assert 'className="change-detection-input-surface"' in panel assert 'aria-label="Change detection input controls"' in panel assert 'className="change-detection-state-stack"' in panel assert 'className="change-detection-result-surface"' in panel assert 'aria-label="Change detection result summary"' in panel assert 'className="change-detection-warning-surface"' in panel def test_change_detection_panel_preserves_existing_compare_controls() -> None: panel = (ROOT / "frontend" / "src" / "components" / "analysis" / "ChangeDetectionPanel.tsx").read_text( encoding="utf-8" ) assert "onSourceDatasetChange" in panel assert "onTargetDatasetChange" in panel assert "onIouThresholdChange" in panel assert "onIncludeUnchangedChange" in panel assert "onRun" in panel assert "Compare vectors" in panel assert "Upload at least two vector datasets to compare." in panel assert "result.added_count" in panel assert "result.removed_count" in panel assert "result.unchanged_count" in panel def test_change_detection_density_css_contracts() -> None: css = (ROOT / "frontend" / "src" / "styles" / "app.css").read_text(encoding="utf-8") assert ".change-detection-shell" in css assert ".change-detection-heading" in css assert ".change-detection-input-surface" in css assert ".change-detection-state-stack" in css assert ".change-detection-result-surface" in css assert ".change-detection-warning-surface" in css assert ".change-detection-shell .form-grid" in css assert ".change-detection-shell .summary-grid" in css assert "grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));" in css assert "grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));" in css