Skip to content

Commit

Permalink
Small adjustments from code review
Browse files Browse the repository at this point in the history
RISDEV-5719
  • Loading branch information
elaydis committed Dec 17, 2024
1 parent 8c43f69 commit eca00fb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 46 deletions.
9 changes: 4 additions & 5 deletions frontend/src/components/category-import/CategoryImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const errorMessage = ref<string | undefined>(undefined)
/**
* Loads the document unit to import category data from.
* Displays an error message, if no document unit could be found with
* the given document number could be found.
* Displays an error message, if no document unit could be found with the given document number.
*/
async function searchForDocumentUnit() {
const response = await documentUnitService.getByDocumentNumber(
Expand All @@ -39,7 +38,7 @@ async function searchForDocumentUnit() {
<template>
<div data-testid="category-import">
<span class="ds-label-01-bold">Rubriken importieren</span>
<div class="flex flex-row items-end gap-8">
<div class="mt-16 flex flex-row items-end gap-8">
<InputField
id="categoryImporterDocumentNumber"
v-slot="slotProps"
Expand Down Expand Up @@ -88,12 +87,12 @@ async function searchForDocumentUnit() {
<IconBadge v-bind="useStatusBadge(documentUnitToImport.status).value" />

<div class="flex flex-col">
<span class="ds-label-02-bold text-gray-900"> Gericht: </span>
<span class="ds-label-02-bold text-gray-900"> Gericht</span>
{{ documentUnitToImport.coreData?.court?.label }}
</div>

<div class="flex flex-col">
<span class="ds-label-02-bold text-gray-900"> Aktenzeichen: </span>
<span class="ds-label-02-bold text-gray-900"> Aktenzeichen</span>
{{ documentUnitToImport.coreData?.fileNumbers?.join(", ") }}
</div>

Expand Down
10 changes: 5 additions & 5 deletions frontend/src/routes/caselaw/documentUnit/[documentNumber].vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ const handleKeyDown = (event: KeyboardEvent) => {
}
switch (event.key) {
case "<": // Ctrl + [
case "<":
event.preventDefault()
toggleNavigationPanel(extraContentSidePanelStore.togglePanel())
break
case "n": // Ctrl + N
case "n":
event.preventDefault()
extraContentSidePanelStore.togglePanel(true)
extraContentSidePanelStore.setSidePanelMode("note")
break
case "d": // Ctrl + D
case "d":
event.preventDefault()
extraContentSidePanelStore.togglePanel(true)
extraContentSidePanelStore.setSidePanelMode("attachments")
break
case "v": // Ctrl + V
case "v":
extraContentSidePanelStore.togglePanel(true)
extraContentSidePanelStore.setSidePanelMode("preview")
break
case "k": // Ctrl + K
case "k":
if (featureToggle.value) {
extraContentSidePanelStore.togglePanel(true)
extraContentSidePanelStore.setSidePanelMode("category-import")
Expand Down
61 changes: 25 additions & 36 deletions frontend/test/e2e/caselaw/category-import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,30 @@ test.describe("category import", () => {
"display category import",
{ tag: ["@RISDEV-5719"] },
async ({ page, prefilledDocumentUnit }) => {
await navigateToCategoryImport(
page,
prefilledDocumentUnit.documentNumber as string,
)
await expect(
page.getByRole("button", { name: "Dokumentationseinheit laden" }),
).toBeVisible()
await expect(
page.getByRole("button", { name: "Dokumentationseinheit laden" }),
).toBeDisabled()
},
)
await test.step("displays category import with disabled button", async () => {
await navigateToCategoryImport(
page,
prefilledDocumentUnit.documentNumber as string,
)
await expect(
page.getByRole("button", { name: "Dokumentationseinheit laden" }),
).toBeVisible()
await expect(
page.getByRole("button", { name: "Dokumentationseinheit laden" }),
).toBeDisabled()
})

test(
"search for non-existent document unit displays error",
{ tag: ["@RISDEV-5719"] },
async ({ page, prefilledDocumentUnit }) => {
await navigateToCategoryImport(
page,
prefilledDocumentUnit.documentNumber as string,
)
await searchForDocumentUnitToImport(page, "invalidnumber")
await expect(
page.getByText("Keine Dokumentationseinheit gefunden."),
).toBeVisible()
},
)
await test.step("search for non-existent document unit displays error", async () => {
await searchForDocumentUnitToImport(page, "invalidnumber")
await expect(
page.getByText("Keine Dokumentationseinheit gefunden."),
).toBeVisible()
})

test(
"search for document unit displays core data",
{ tag: ["@RISDEV-5719"] },
async ({ page, prefilledDocumentUnit }) => {
await navigateToCategoryImport(
page,
prefilledDocumentUnit.documentNumber as string,
)
await searchForDocumentUnitToImport(page, "YYTestDoc0013")
await expect(page.getByText("fileNumber5")).toBeVisible()
await test.step("search for document unit displays core data", async () => {
await searchForDocumentUnitToImport(page, "YYTestDoc0013")
await expect(page.getByText("fileNumber5")).toBeVisible()
})
},
)

Expand Down Expand Up @@ -79,6 +65,9 @@ test.describe("category import", () => {
page: Page,
documentNumber: string,
) {
await page
.getByRole("textbox", { name: "Dokumentnummer Eingabefeld" })
.fill("")
await page.getByLabel("Dokumentnummer Eingabefeld").click()
await page.keyboard.type(documentNumber)
await expect(
Expand Down

0 comments on commit eca00fb

Please sign in to comment.