Test that a mission label's click never acts on the card or reader beneath it

ALPR, News, Wildlife Sightings, Fire Perimeters, GhostMaps and Drone
Airspace each skip their own card or overlay hit test when a painted label
took the click. Each now has a test that a click the label took does not
select the camera or sighting, open the report, or open the card's link,
and lets go of the current selection, while the same click off the label
still acts. ALPR's presentation gets its first test file.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 17:23:35 -08:00
1 parent 74d38e6d14
commit c53a6d1c51
7 files changed
+331 -8

No files matched your search

@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import test from 'node:test';
import { createSelection } from './selection.js';
import { bindWildlifeViewer } from '../../testSupport/wildlifeViewer.mjs';
import { fakeInputUnderLabel } from '../../input/testDoubles.mjs';
const row = {
stableId: 'inat:123',
@@ -304,6 +305,35 @@ test('empty clicks and layer removal release the selected row and its overlay',
assert.equal(f.entries.size, 0);
});
test("a click a label painted over a sighting's card takes never selects the sighting, and lets go of the selected one", (t) => {
let fake = null;
const f = fixture(row, {
input: (viewer) => {
fake ??= fakeInputUnderLabel(viewer);
return fake.input;
},
});
f.selection.install();
t.after(() => {
f.selection.remove();
fake.destroy();
});
f.selection.refreshAmbient();
// The sighting's name card lies under every click.
f.hit('wildlife-sightings-labels', 'wildlife-sightings-label:inat:123');
// Off the label, a click on the card selects and focuses the sighting.
fake.click();
assert.equal(f.state.selectedId, row.stableId);
assert.equal(f.flights.length, 1);
fake.label.over = true;
fake.click();
assert.equal(f.state.selectedId, null, 'the selected sighting is let go');
assert.equal(f.state.selectedRow, null);
assert.equal(f.flights.length, 1, 'the camera is not sent to the sighting');
});
test('a tap selects only a sighting exactly under it, not one the touch search found near it', () => {
const f = fixture();
f.selection.install();