From e04f6056d04661558d56e549fa6998b5a99a27a3 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Sun, 7 Jun 2026 11:21:35 +0200 Subject: [PATCH] refactor: replace NcCheckboxRadioSwitch with NcRadioGroup in PillMenu and add groupLabel prop Signed-off-by: Christian Hartmann --- playwright/support/sections/ResultsSection.ts | 14 +++- playwright/support/sections/TopBarSection.ts | 7 +- src/components/PillMenu.vue | 81 +++++++++---------- src/components/TopBar.vue | 1 + src/views/Results.vue | 1 + 5 files changed, 55 insertions(+), 49 deletions(-) diff --git a/playwright/support/sections/ResultsSection.ts b/playwright/support/sections/ResultsSection.ts index d200c5a7f..ac13b5ace 100644 --- a/playwright/support/sections/ResultsSection.ts +++ b/playwright/support/sections/ResultsSection.ts @@ -24,13 +24,19 @@ export class ResultsSection { } public async switchToSummary(): Promise { - // NcCheckboxRadioSwitch renders a hidden with - // v-on="{ change: onToggle }". Dispatch the change event directly. - await this.summaryTab.dispatchEvent('change') + if (await this.summaryTab.isChecked()) { + return + } + // NcRadioGroupButton wraps the hidden radio input in a clickable container. + // Click the parent to trigger the same interaction path as a real user. + await this.summaryTab.locator('xpath=..').click() } public async switchToResponses(): Promise { - await this.responsesTab.dispatchEvent('change') + if (await this.responsesTab.isChecked()) { + return + } + await this.responsesTab.locator('xpath=..').click() } /** diff --git a/playwright/support/sections/TopBarSection.ts b/playwright/support/sections/TopBarSection.ts index 9c40e1daf..cdc9c34e6 100644 --- a/playwright/support/sections/TopBarSection.ts +++ b/playwright/support/sections/TopBarSection.ts @@ -37,10 +37,9 @@ export class TopBarSection { if (await radio.isChecked()) { return } - // NcCheckboxRadioSwitch hides the input inside a label; click the label - // to trigger Vue's event chain rather than force-checking the hidden input - // (which would fail because Vue resets the controlled input state before - // Playwright can verify it) + // The radio input is visually hidden and wrapped in a clickable button-like + // container. Click the parent container to follow the real user interaction + // path and let Vue update the controlled state. await radio.locator('xpath=..').click() await this.page.waitForURL(viewRoutes[view]) } diff --git a/src/components/PillMenu.vue b/src/components/PillMenu.vue index 1555ba62b..c177964f2 100644 --- a/src/components/PillMenu.vue +++ b/src/components/PillMenu.vue @@ -5,38 +5,39 @@ - - + diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue index d1e071bd1..030cf5e92 100644 --- a/src/components/TopBar.vue +++ b/src/components/TopBar.vue @@ -14,6 +14,7 @@ v-if="!canOnlySubmit && currentView" :active="currentView" :options="availableViews" + :groupLabel="t('forms', 'View mode')" @update:active="onChangeView" />