From b64b58d1f222d923d170d3c9daa2abbaa97cfeaf Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 23 Nov 2026 22:48:41 +0100 Subject: [PATCH] feat(section): show sections as headings in the results summary The results summary shows each section as a heading with its description above the summaries of its questions, so the results read like the form. The sections come from the form itself; the results endpoint, the individual responses and the export keep listing questions only. The summaries of the questions in a section are headed one level below the section, as on the respondent's pages. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger --- playwright/e2e/sections.spec.ts | 42 ++++++++++++++ src/components/Results/ResultsSummary.vue | 12 +++- src/views/Results.vue | 69 +++++++++++++++++++++-- 3 files changed, 115 insertions(+), 8 deletions(-) diff --git a/playwright/e2e/sections.spec.ts b/playwright/e2e/sections.spec.ts index 833c27201..7dc7974b6 100644 --- a/playwright/e2e/sections.spec.ts +++ b/playwright/e2e/sections.spec.ts @@ -790,6 +790,48 @@ test.describe('Sections', () => { ).toHaveValue('Part one') }) + test('The results summary shows sections as headings between the questions', async ({ + page, + }) => { + const form = await api(page.request, 'POST', '/forms') + const ids: number[] = [] + for (const [type, text] of [ + ['short', 'Intro'], + ['section', 'Part one'], + ['short', 'First'], + ['section', ''], + ['short', 'Second'], + ]) { + ids.push( + ( + await api(page.request, 'POST', `/forms/${form.id}/questions`, { + type, + text, + }) + ).id, + ) + } + await api(page.request, 'PATCH', `/forms/${form.id}/questions/${ids[1]}`, { + keyValuePairs: { description: 'Questions about the first part' }, + }) + await api(page.request, 'POST', `/forms/${form.id}/submissions`, { + answers: { [ids[0]]: ['hello'], [ids[2]]: ['world'] }, + }) + await page.goto(`apps/forms/${form.hash}/results`) + + const main = page.getByRole('main') + await expect(main.getByRole('heading', { level: 3 })).toHaveText([ + 'Intro', + 'Part one', + 'Second', + ]) + await expect(main.getByRole('heading', { level: 4 })).toHaveText(['First']) + const section = page.locator('.results-section') + await expect(section).toHaveCount(1) + await expect(section).toContainText('Questions about the first part') + await expect(section).not.toContainText('Section') + }) + test('Each page checks its required questions, an empty section is an info page', async ({ page, submitView, diff --git a/src/components/Results/ResultsSummary.vue b/src/components/Results/ResultsSummary.vue index e9a76e98e..872dba402 100644 --- a/src/components/Results/ResultsSummary.vue +++ b/src/components/Results/ResultsSummary.vue @@ -5,9 +5,9 @@