From 82301f0b30f2319daae35b2e425c3abd7a675ed8 Mon Sep 17 00:00:00 2001 From: Nabil-Fareed Alikhan Date: Fri, 4 Sep 2026 08:33:55 +0100 Subject: [PATCH] Preserve hidden GC data in saved sessions --- hooks/useBRIGController.ts | 9 +-------- tests/e2e/brigx.spec.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/hooks/useBRIGController.ts b/hooks/useBRIGController.ts index 54dcc9a..0a9dace 100644 --- a/hooks/useBRIGController.ts +++ b/hooks/useBRIGController.ts @@ -310,14 +310,7 @@ export function useBRIGController() { params, imageProperties, referenceAnnotations, - plotData ? { - ...plotData, - reference: { - ...plotData.reference, - gcContent: params.showGCContent !== false ? plotData.reference.gcContent : undefined, - gcSkew: params.showGCSkew !== false ? plotData.reference.gcSkew : undefined, - }, - } : null, + plotData, ); const blob = new Blob([json], { type: 'application/json' }); const url = URL.createObjectURL(blob); diff --git a/tests/e2e/brigx.spec.ts b/tests/e2e/brigx.spec.ts index 3e0d456..2c38819 100644 --- a/tests/e2e/brigx.spec.ts +++ b/tests/e2e/brigx.spec.ts @@ -589,6 +589,27 @@ test.describe('BRIGX e2e — circular genome plot', () => { const svg = await fs.readFile(downloadedPath!, 'utf8') expect(svg).not.toContain('id="gc-content-ring"') expect(svg).toContain('id="gc-skew-ring"') + + const sessionDownloadPromise = page.waitForEvent('download') + await page.getByRole('button', { name: 'Save session' }).click() + const sessionDownload = await sessionDownloadPromise + const sessionPath = await sessionDownload.path() + expect(sessionPath).not.toBeNull() + const session = JSON.parse(await fs.readFile(sessionPath!, 'utf8')) + expect(session.params.showGCContent).toBe(false) + expect(session.result.plot.reference.gcContent.length).toBeGreaterThan(0) + + await page.getByLabel('Load session').setInputFiles(sessionPath!) + await expect(page.getByText('Session and saved result loaded.')).toBeVisible() + await expect(page.getByLabel('GC Content')).not.toBeChecked() + await page.getByLabel('GC Content').check() + + const restoredDownloadPromise = page.waitForEvent('download') + await page.getByRole('button', { name: 'SVG', exact: true }).click() + const restoredDownload = await restoredDownloadPromise + const restoredPath = await restoredDownload.path() + expect(restoredPath).not.toBeNull() + expect(await fs.readFile(restoredPath!, 'utf8')).toContain('id="gc-content-ring"') }) test('PNG export matches the live canvas after moving a legend', async ({ page }) => {