First Bedside commit. Delivers the /app/bedside page with the full 15-pill sub-nav in the same order + labels as the vanilla app, and switches the sidebar Bedside link to available. client/src/pages/Bedside.tsx Single-file shell. PILLS array is the single source of truth for pill ID / label / icon / summary, ordered to match public/components/bedside.html (neonatal, airway, cardiac, respiratory, ventilation, seizure, sepsis, anaphylaxis, sedation, agitation, antiemetics, antimicrobials, burns, toxicology, trauma). Clicking a pill flips useState<active>, and LegacyPanel renders a summary of that module + a button to open the legacy Bedside tab. What is intentionally NOT in this commit Each pill's actual clinical dosing panel stays in vanilla for now. Those panels encode weight-based dosing, syndrome-keyed antimicrobials, and PALS / ALS formulas — exactly the class of content the migration checkpoint memory flags as must-not-be- "simplified" by an LLM. They belong in per-module commits that land alongside the calculators port (APLS + Best Guess weight, Fenton 2013 LMS, AAP 2022 bilirubin, Rosner BP splines) where test vectors can verify byte-for-byte parity with the vanilla output. The top-level age → weight estimator also waits on calculators — it calls window._PED_MATH.estimateWeightFromAgeMonths in the vanilla module, which is defined in public/js/calculators.js. e2e/tests/bedside-react.spec.js — three smoke tests All 15 pills render by data-testid, clicking a pill swaps the panel, and the legacy-viewer link is present. The pill-order list is hard-coded in the spec so re-ordering or dropping a pill trips a loud failure. Client tsc -b + vite build clean. Bundle 456.71 kB / 130.53 kB gz.
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
// ============================================================
|
|
// BEDSIDE (React port) — sub-nav shell smoke test.
|
|
//
|
|
// First-commit scope: the 15 sub-pills render in the expected order
|
|
// and selecting a pill reveals a panel with a legacy-viewer link.
|
|
// Actual clinical dosing panels (neonatal through trauma) port in
|
|
// dedicated follow-up commits alongside the calculators.
|
|
// ============================================================
|
|
|
|
const { test, expect, E2E_BASE } = require('../fixtures');
|
|
|
|
const EXPECTED_PILLS = [
|
|
'neonatal', 'airway', 'cardiac', 'respiratory', 'ventilation',
|
|
'seizure', 'sepsis', 'anaphylaxis', 'sedation', 'agitation',
|
|
'antiemetics', 'antimicrobials', 'burns', 'toxicology', 'trauma',
|
|
];
|
|
|
|
async function openReactBedside(page) {
|
|
await page.goto(E2E_BASE + '/app/bedside');
|
|
await page.waitForSelector('[data-testid="bedside-subnav"]', { timeout: 15000 });
|
|
}
|
|
|
|
test.describe('React Bedside — sub-nav shell', () => {
|
|
|
|
test('all 15 sub-pills render in the expected order', async ({ authedPage: _, page }) => {
|
|
await openReactBedside(page);
|
|
for (const id of EXPECTED_PILLS) {
|
|
await expect(page.locator('[data-testid="bedside-pill-' + id + '"]')).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('clicking a pill switches the active panel', async ({ authedPage: _, page }) => {
|
|
await openReactBedside(page);
|
|
await expect(page.locator('[data-testid="bedside-panel-neonatal"]')).toBeVisible();
|
|
await page.click('[data-testid="bedside-pill-airway"]');
|
|
await expect(page.locator('[data-testid="bedside-panel-airway"]')).toBeVisible();
|
|
});
|
|
|
|
test('panel carries a legacy-viewer link', async ({ authedPage: _, page }) => {
|
|
await openReactBedside(page);
|
|
await expect(page.getByText('Open in legacy viewer').first()).toBeVisible();
|
|
});
|
|
});
|