From 4875172f81bb14f0bc49b43fa8f8660f16079021 Mon Sep 17 00:00:00 2001 From: nbabai Date: Mon, 25 Nov 2024 13:34:16 +0100 Subject: [PATCH] Fixing page number in references (#2397) * Fix page number in references RISDEV-5434 * Fix page number in reference search RISDEV-5434 --- .../PeriodicalEditionReferenceInput.vue | 7 ++++++ .../legal-periodical-evaluation.spec.ts | 22 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/frontend/src/components/periodical-evaluation/references/PeriodicalEditionReferenceInput.vue b/frontend/src/components/periodical-evaluation/references/PeriodicalEditionReferenceInput.vue index e6d0b8cefa..fa4729a5ba 100644 --- a/frontend/src/components/periodical-evaluation/references/PeriodicalEditionReferenceInput.vue +++ b/frontend/src/components/periodical-evaluation/references/PeriodicalEditionReferenceInput.vue @@ -271,6 +271,13 @@ watch( { deep: true }, ) +/** watches the changes of query related documentations params + * resets the page if change took place. + */ +watch(searchResultsCurrentPage, () => { + pageNumber.value = 0 +}) + onMounted(async () => { featureToggle.value = ( await FeatureToggleService.isEnabled("neuris.new-from-search") diff --git a/frontend/test/e2e/caselaw/legal-periodical-evaluation.spec.ts b/frontend/test/e2e/caselaw/legal-periodical-evaluation.spec.ts index acb965831b..ebfd6aa304 100644 --- a/frontend/test/e2e/caselaw/legal-periodical-evaluation.spec.ts +++ b/frontend/test/e2e/caselaw/legal-periodical-evaluation.spec.ts @@ -550,6 +550,28 @@ test.describe( }, ) + test( + "Search for references", + { tag: "@RISDEV-5434" }, + async ({ page, edition }) => { + await test.step("Page number resets when query parameters are changed", async () => { + const fileNumber = "1" + + await navigateToPeriodicalReferences(page, edition.id) + + await page.getByText("Suchen").click() + await page.getByLabel("nächste Ergebnisse").click() + await expect(page.getByText("Seite 2")).toBeVisible() + + await fillInput(page, "Aktenzeichen", fileNumber) + await page.getByText("Suchen").click() + + await expect(page.getByText("Seite 2")).toBeHidden() + await expect(page.getByText("Seite 1")).toBeVisible() + }) + }, + ) + // Flaky, needs some clarification // eslint-disable-next-line playwright/no-skipped-test test.skip(