Keep the Routes panel's entries across a trip to another tab
The panel was unmounted with its tab, so leaving it reset departure, destination and range. The range reset was also a lie: the slider came back at 3 pc while the scene kept drawing the graph at the range last chosen. The panel now stays mounted and is hidden while another tab is open, which still replays the acquire wipe when it is shown again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016jxMkwA2rbicdGxHosecYi
This commit is contained in:
@@ -252,4 +252,32 @@ describe('HudDockComponent', () => {
|
||||
fixture.detectChanges();
|
||||
expect(tab('Readout').getAttribute('aria-selected')).toBe('true');
|
||||
});
|
||||
|
||||
it('keeps what the Routes panel was set to across a trip to another tab', () => {
|
||||
setReadout();
|
||||
fixture.componentRef.setInput('routing', true);
|
||||
fixture.componentRef.setInput('routeOptions', [{ id: 7, name: 'Sirius', subtitle: '2.6 pc' }]);
|
||||
fixture.componentRef.setInput('defaultTab', 'routes');
|
||||
fixture.detectChanges();
|
||||
|
||||
const destination = host().querySelector<HTMLInputElement>('#route-to')!;
|
||||
destination.value = 'Sir';
|
||||
destination.dispatchEvent(new Event('input'));
|
||||
fixture.detectChanges();
|
||||
host().querySelector<HTMLButtonElement>('#dock-panel-routes ul button')!.click();
|
||||
const range = host().querySelector<HTMLInputElement>('#route-range')!;
|
||||
range.value = '6';
|
||||
range.dispatchEvent(new Event('input'));
|
||||
fixture.detectChanges();
|
||||
|
||||
tab('Readout').click();
|
||||
fixture.detectChanges();
|
||||
expect(host().querySelector<HTMLElement>('#dock-panel-routes')!.hidden).toBe(true);
|
||||
tab('Routes').click();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(host().querySelector<HTMLElement>('#dock-panel-routes')!.hidden).toBe(false);
|
||||
expect(host().querySelector<HTMLInputElement>('#route-to')!.value).toBe('Sirius');
|
||||
expect(host().querySelector<HTMLInputElement>('#route-range')!.value).toBe('6');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user