From 5c1d1619c702a9052d75eb1720ba61283b71620e Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 23 Apr 2026 17:06:26 +0200 Subject: [PATCH] fix(nav): move image lightbox to index.html so NRP + seizure pathways open from the Bedside tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The #img-lightbox overlay markup was sitting at the bottom of calculators.html. Before the reorg it was fine — the calculators tab was always the only home for bedside, so by the time a user clicked the seizure or NRP pathway button the lightbox HTML was guaranteed to be in the DOM. After promoting Bedside to its own tab, a user can open Bedside -> Seizures without having visited Calculators first; the lightbox JS's getElementById('img-lightbox') then returns null and the click silently no-ops. Moved the overlay markup to the bottom of index.html so it exists from page load regardless of which tab has been lazy-loaded. The e2e harness gets a duplicate copy so the existing lightbox smoke test keeps working. Added a regression test for NRP (bedside-smoke.spec.js:141) to catch any future breakage — the prior seizure-only test didn't exercise the second pathway button and so the neonatal/NRP path had never been clicked in CI. Suite: 252 passed / 0 failed. --- e2e/tests/bedside-smoke.spec.js | 15 ++++++++++++++- public/components/calculators.html | 13 ++++--------- public/e2e-harness.html | 11 +++++++++++ public/index.html | 13 +++++++++++++ 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/e2e/tests/bedside-smoke.spec.js b/e2e/tests/bedside-smoke.spec.js index 3d20e3a..67604a4 100644 --- a/e2e/tests/bedside-smoke.spec.js +++ b/e2e/tests/bedside-smoke.spec.js @@ -129,10 +129,23 @@ test.describe('Bedside — dose calculators fire', () => { }); test.describe('Bedside — interactive widgets', () => { - test('Lightbox: View pathway image button opens modal', async ({ page }) => { + test('Lightbox: seizure pathway image opens and closes', async ({ page }) => { await openBedside(page, 'seizure'); await page.click('button[data-img-src="/img/epilepsy_eiic_pathway.png"]'); await expect(page.locator('#img-lightbox')).toBeVisible(); + await expect(page.locator('#img-lightbox-img')).toHaveAttribute('src', /epilepsy_eiic_pathway/); + await page.click('#img-lightbox-close'); + await expect(page.locator('#img-lightbox')).toBeHidden(); + }); + + test('Lightbox: NRP pathway image opens on neonatal sub-pill', async ({ page }) => { + await openBedside(page, 'neonatal'); + // The "View pathway image" button sits inside a collapsed
+ // titled "NRP Resuscitation Pathway" — expand it first. + await page.getByText('NRP Resuscitation Pathway').click(); + await page.click('button[data-img-src="/img/nrp_pathway.png"]'); + await expect(page.locator('#img-lightbox')).toBeVisible(); + await expect(page.locator('#img-lightbox-img')).toHaveAttribute('src', /nrp_pathway/); await page.click('#img-lightbox-close'); await expect(page.locator('#img-lightbox')).toBeHidden(); }); diff --git a/public/components/calculators.html b/public/components/calculators.html index 41f5f15..13b91b9 100644 --- a/public/components/calculators.html +++ b/public/components/calculators.html @@ -652,12 +652,7 @@ - - + + diff --git a/public/e2e-harness.html b/public/e2e-harness.html index fdd695b..6fc88b4 100644 --- a/public/e2e-harness.html +++ b/public/e2e-harness.html @@ -25,5 +25,16 @@ + + + diff --git a/public/index.html b/public/index.html index 271e216..9be9c25 100644 --- a/public/index.html +++ b/public/index.html @@ -470,5 +470,18 @@ + +