Skip to content

Commit

Permalink
Revert "Automatically open preview, if one search result"
Browse files Browse the repository at this point in the history
This reverts commit 3e8bb86.
  • Loading branch information
leonie-koch committed Dec 30, 2024
1 parent 3e8bb86 commit 2abfcf1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import ComboboxItemService from "@/services/comboboxItemService"
import documentUnitService from "@/services/documentUnitService"
import FeatureToggleService from "@/services/featureToggleService"
import { ResponseError } from "@/services/httpClient"
import { useDocumentUnitStore } from "@/stores/documentUnitStore"
import { useEditionStore } from "@/stores/editionStore"
import { useExtraContentSidePanelStore } from "@/stores/extraContentSidePanelStore"
import StringsUtil from "@/utils/stringsUtil"
const props = defineProps<{
Expand All @@ -46,8 +44,6 @@ const emit = defineEmits<{
const containerRef = ref<HTMLElement | null>(null)
const store = useEditionStore()
const documentUnitStore = useDocumentUnitStore()
const extraContentSidePanelStore = useExtraContentSidePanelStore()
const reference = ref<Reference>(new Reference({ ...props.modelValue }))
const validationStore = useValidationStore()
const pageNumber = ref<number>(0)
Expand Down Expand Up @@ -272,18 +268,6 @@ async function deleteReferenceAndDocUnit() {
deleteReference()
}
async function openSidePanel(documentUnitNumber?: string) {
if (documentUnitNumber) {
await documentUnitStore.loadDocumentUnit(documentUnitNumber)
extraContentSidePanelStore.togglePanel(true)
}
}
async function closeSidePanel() {
await documentUnitStore.unloadDocumentUnit()
extraContentSidePanelStore.togglePanel(false)
}
/*
Relates the legal periodical of edition to the reference
*/
Expand Down Expand Up @@ -326,16 +310,10 @@ watch(
)
/** watches the changes of query related documentations params
* resets the page if change took place. If one search results, open side panel.
* resets the page if change took place.
*/
watch(searchResultsCurrentPage, async () => {
watch(searchResultsCurrentPage, () => {
pageNumber.value = 0
if (searchResults.value && searchResults.value.length == 1) {
await openSidePanel(searchResults.value[0].decision.documentNumber)
} else {
await closeSidePanel()
}
})
onMounted(async () => {
Expand Down
10 changes: 2 additions & 8 deletions frontend/test/e2e/caselaw/e2e-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,17 +660,11 @@ export async function searchForDocUnitWithFileNumberAndDecisionDate(
date: string,
) {
await fillInput(page, "Gericht", "AG Aachen")
await page
.getByLabel("dropdown-option")
.getByText("AG Aachen", { exact: true })
.click()
await page.getByText("AG Aachen", { exact: true }).click()
await fillInput(page, "Aktenzeichen", fileNumber)
await fillInput(page, "Entscheidungsdatum", date)
await fillInput(page, "Dokumenttyp", "AnU")
await page
.getByLabel("dropdown-option")
.getByText("Anerkenntnisurteil", { exact: true })
.click()
await page.getByText("Anerkenntnisurteil", { exact: true }).click()

await page.getByText("Suchen").click()
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ test.describe("Editing and deleting references in periodical evaluation", () =>
).not.toBeEditable()
})

await test.step("should automatically open preview, when only one search result", async () => {
await test.step("should open and close document preview in side panel", async () => {
await searchForDocUnitWithFileNumberAndDecisionDate(
page,
fileNumber,
"31.12.2019",
)
await openExtraContentSidePanelPreview(page, fileNumber)
await expect(page.getByLabel("Seitenpanel öffnen")).toBeHidden()

await closeExtraContentSidePanelPreview(page)
Expand Down Expand Up @@ -162,9 +163,7 @@ test.describe("Editing and deleting references in periodical evaluation", () =>
await expect(decisionElement.nth(1)).toBeVisible()

await expect(
page
.getByTestId("editable-list-container")
.getByText(`MMG 2024, 5${suffix} (LT)`, { exact: true }),
page.getByText(`MMG 2024, 5${suffix} (LT)`, { exact: true }),
).toBeVisible()
})

Expand Down

0 comments on commit 2abfcf1

Please sign in to comment.