refactor(street-level): trim dead paths, duplicated labels and test-only API

- visibleBbox: no view-rectangle fallback or grid option; its one caller
  always ranges the rays
- tilesForBbox returns the tiles; normalizeBbox takes arrays only
- viewerHost: no try/catch around adapter calls that catch for themselves
- coverage: counts come from the drawn sequences; no sequenceCount export
- one keyStatusLabel for the pill and the layer list
- no constructor source check, double-init guard or selectSequence /
  clearSequence on the layer

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
German KhokhlovandClaude Opus 5.5 committed 2026-10-08 17:04:05 +04:00
1 parent 777aa62586
commit d59b4d05bb
14 files changed
+73 -116

No files matched your search

+11 -9
View File
@@ -205,23 +205,26 @@ test('switching Mapillary off clears coverage and closes the image it shows', as
assert.equal(layer.getUIState().providerOn, false);
});
test('a sequence error goes with the sequence and leaves the viewer’s own', async (t) => {
test('a sequence that fails to load reports it apart from the photo, and the error goes with it', async (t) => {
const source = fakeMapillarySource({
getSequenceImages: async () => {
throw new Error('Sequence images unavailable');
},
});
const { layer } = await startLayer(t, { source });
await layer.selectSequence('seq-1');
layer.attachViewerHost(null);
await layer.openImage('img1');
// The photo's pose names its sequence, which opening selects.
const photoViewer = fakePhotoViewer({
pose: { position: { lon: -121.49, lat: 38.58 }, sequenceId: 'seq-1' },
});
const { layer } = await startLayer(t, { source, photoViewer });
layer.attachViewerHost({});
assert.equal(await layer.openImage('img1'), true);
await settle();
let ui = layer.getUIState();
assert.equal(ui.sequence.error, 'Sequence images unavailable');
assert.match(ui.street.error, /Open the Street Level panel/);
layer.clearSequence();
assert.equal(ui.street.error, null, 'the photo itself is fine');
layer.closeViewer();
ui = layer.getUIState();
assert.equal(ui.sequence.error, null, 'withdrawn with the sequence');
assert.match(ui.street.error, /Open the Street Level panel/, 'kept');
});
test('closing the photo, switching the layer off or destroying it stops the framing flight', async (t) => {
@@ -245,7 +248,6 @@ test('closing the photo, switching the layer off or destroying it stops the fram
});
test('setParams takes "any date" (0 days) and the switch over the current values (share-link defaults)', async (t) => {
assert.throws(() => createStreetLevelLayer({ source: {} }), /source/);
const { layer } = await startLayer(t);
assert.deepEqual(layer.getParams(), {
mapillary: true,