mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-26 21:47:20 +00:00
3a69ad0906
The focus handoff from #2925 tracked Retry focus with focus/blur handlers. Chromium blurs a focused element when it leaves the DOM, and the Show branch removes the button before the error effect runs, so the flag was already false and focus fell to the page. jsdom never blurs on removal, which is why the unit test passed. Read document.activeElement when the Retry branch is disposed instead, and make the refresh test model the removal blur so it fails against the old code. The worker-browser proofs for history response, pointer, inspection, window and the three PBS fixtures still clicked the removed History tab and Refresh button. They now read the charts on Overview, drive reads through the 30-second poll, select series paths rather than every path (bands and dots add paths), and mount fixtures in a shared app runtime (fixtureRuntime.tsx) because drawers read the WebSocket and theme contexts. The PBS refresh proof is what caught the focus regression.
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
// Shared app runtime for browser fixtures. Drawers read active alerts and the
|
|
// theme from the app runtime contexts and some components use router links, so
|
|
// a fixture that mounts them without these providers throws before rendering.
|
|
// The WebSocket context is an explicit offline one: no live socket, no alerts.
|
|
import type { Component } from 'solid-js';
|
|
import { render } from 'solid-js/web';
|
|
import { Route, Router } from '@solidjs/router';
|
|
|
|
import { DarkModeContext, WebSocketContext } from '../src/contexts/appRuntime';
|
|
|
|
export const renderInAppRuntime = (Fixture: Component, root = document.getElementById('root')) =>
|
|
render(
|
|
() => (
|
|
<WebSocketContext.Provider
|
|
value={{ state: { pmg: [] }, activeAlerts: {}, connected: () => false } as never}
|
|
>
|
|
<DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>
|
|
<Router>
|
|
<Route path="/*" component={Fixture} />
|
|
</Router>
|
|
</DarkModeContext.Provider>
|
|
</WebSocketContext.Provider>
|
|
),
|
|
root as HTMLElement,
|
|
);
|