refactor: isolate Map Source controls and selection lifecycle

This commit is contained in:
Sameh Khamis committed 2026-09-12 22:25:04 -07:00
1 parent 78199c2ab3
commit 72d531b18f
14 files changed
+405 -72

No files matched your search

+16 -20
View File
@@ -347,26 +347,22 @@ test('the Visual Presets tray owns Map Source and the retired left panel is abse
assert.match(panels, /event\.key !== 'Escape'[\s\S]*?disclosure\?\.focus/);
assert.match(ui, /querySelector\('\.map-stack-chip\.active'\)\s*\|\| panel\.querySelector\('\.map-stack-chip'\)/);
assert.match(
ui,
/renderMapStackChips\(this\._mapStackChips, this\.mapStackController\.getStacks\(\), \{[\s\S]*?onSelect: \(stackId\) => \{ this\._setMapStack\(stackId\); \}/,
'chips must dispatch through the same _setMapStack path the dropdown used',
);
assert.match(
ui,
/_renderMapStackState\(state\) \{[\s\S]*?syncMapStackChips\(this\._mapStackChips, state\.activeId\)/,
'the active chip must be re-synced from controller state',
);
assert.match(
ui,
/window\.addEventListener\('gev:map-stack-changed', this\._mapStackChangeHandler\)/,
'provider-driven fallback must re-sync the UI without a user click',
);
assert.match(
ui,
/window\.removeEventListener\('gev:map-stack-changed', this\._mapStackChangeHandler\)/,
'the provider-driven state listener must be released with StyleManager',
);
const controls = readFileSync(new URL('./ui/mapSourceControls.js', import.meta.url), 'utf8');
assert.match(ui, /return this\._mapSourceControls\.select\(stackId, \{ syncShare \}\)/,
'the application action uses the component selection path');
assert.match(controls, /onSelect: [\s\S]*?select\(id\)/,
'chip clicks use the same component selection path');
assert.match(controls, /await controller\.setStack\(stackId\)/,
'selection still delegates source loading to the map controller');
assert.match(controls, /render\(controller\.getState\(\)\)/,
'the active chip is re-synced from actual controller state');
assert.match(ui, /window\.addEventListener\('gev:map-stack-changed', onChange\)/,
'provider-driven fallback reaches the component without a user click');
assert.match(ui, /window\.removeEventListener\('gev:map-stack-changed', onChange\)/,
'the provider-driven subscription has an explicit remover');
assert.match(controls, /unsubscribe\?\.\(\)/,
'component destruction releases its subscription');
});
test('Esri fallbacks report and attribute the imagery source actually rendered', () => {