Skip to content
15 changes: 12 additions & 3 deletions frontend/src/components/LeftoverMapPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ function leftoverMapPlotAxisText(
* comparison-graphic and rank labels rather than adding SPA translation debt.
* ADR 0319 captions leftover-map distance on that comparison graphic using
* the same localized composition boundary rather than adding another static
* comparison-only translation key. ADR 0321 adds persisted comparison-axis
* singular evidence without deriving it from axis share.
* comparison-only translation key. ADR 0320 names comparison coordinate ticks
* through the same composition boundary, preserving localized generic tick copy.
* ADR 0321 adds persisted comparison-axis singular evidence without deriving it
* from axis share.
* Never invent a leftover score.
*/
export function LeftoverMapPlot({
Expand Down Expand Up @@ -343,7 +345,14 @@ export function LeftoverMapPlot({
<g
key={`tick:${tick.axis}:${tick.label}`}
className="leftover-map-plot-tick"
aria-label={tf(LEFTOVER_MAP_PLOT_TICK, { axis: tick.axis, value: tick.label })}
aria-label={
variant === "comparison"
? `${t(LEFTOVER_MAP_COMPARE_PLOT_LABEL)}: ${tf(LEFTOVER_MAP_PLOT_TICK, {
axis: tick.axis,
value: tick.label,
})}`
: tf(LEFTOVER_MAP_PLOT_TICK, { axis: tick.axis, value: tick.label })
}
>
<line x1={tick.x} y1={tick.y} x2={tick.tickX2} y2={tick.tickY2} />
<text
Expand Down
16 changes: 5 additions & 11 deletions tests/test_grouping_comparison_graphic_tick_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,17 @@


def test_comparison_graphic_names_ticks_with_distinct_accessible_copy() -> None:
"""Comparison tick names must not reuse the report-graphic tick key."""
"""Comparison ticks compose existing localized comparison and tick copy."""
plot_source = PLOT_SOURCE.read_text(encoding="utf-8")
layout_source = LAYOUT_SOURCE.read_text(encoding="utf-8")

assert (
'export const LEFTOVER_MAP_COMPARE_PLOT_TICK =\n'
' "leftover map comparison graphic leftover-map axis {axis} tick {value}";'
in layout_source
)
assert "LEFTOVER_MAP_COMPARE_PLOT_TICK" in plot_source
assert "LEFTOVER_MAP_COMPARE_PLOT_LABEL" in plot_source
assert "LEFTOVER_MAP_PLOT_TICK" in plot_source
assert re.search(
r'variant\s*===\s*"comparison"\s*\?\s*LEFTOVER_MAP_COMPARE_PLOT_TICK\s*:\s*LEFTOVER_MAP_PLOT_TICK',
r'variant\s*===\s*"comparison"\s*\?\s*`\$\{t\(LEFTOVER_MAP_COMPARE_PLOT_LABEL\)\}:\s*\$\{tf\(LEFTOVER_MAP_PLOT_TICK,\s*\{\s*axis:\s*tick\.axis,\s*value:\s*tick\.label,?\s*\}\)\}`\s*:\s*tf\(LEFTOVER_MAP_PLOT_TICK,\s*\{\s*axis:\s*tick\.axis,\s*value:\s*tick\.label,?\s*\}\)',
plot_source,
re.DOTALL,
)
assert "axis: tick.axis" in plot_source
assert "value: tick.label" in plot_source
assert "LEFTOVER_MAP_COMPARE_PLOT_TICK" not in plot_source


def test_tick_positions_come_from_persisted_coordinates_not_distance() -> None:
Expand Down
Loading