diff --git a/frontend/.storybook/mockData.ts b/frontend/.storybook/mockData.ts index 3fcae104..6da5d5eb 100644 --- a/frontend/.storybook/mockData.ts +++ b/frontend/.storybook/mockData.ts @@ -1,17 +1,15 @@ -import { auditLogFactory } from "../src/fixtures/auditLog"; -import { coReviewsFactory } from "../src/fixtures/coReview"; import { FIXTURE_DESTRUCTION_LIST, + FIXTURE_SELECTIELIJSTKLASSE_CHOICES, + auditLogFactory, + coReviewsFactory, destructionListAssigneesFactory, destructionListFactory, -} from "../src/fixtures/destructionList"; -import { FIXTURE_SELECTIELIJSTKLASSE_CHOICES } from "../src/fixtures/selectieLijstKlasseChoices"; -import { recordManagerFactory, userFactory, usersFactory, -} from "../src/fixtures/user"; -import { zaaktypeChoicesFactory } from "../src/fixtures/zaaktypeChoices"; + zaaktypeChoicesFactory, +} from "../src/fixtures"; export const MOCKS = { // READS diff --git a/frontend/.storybook/playFunctions.ts b/frontend/.storybook/playFunctions.ts index 1bde8713..9103c466 100644 --- a/frontend/.storybook/playFunctions.ts +++ b/frontend/.storybook/playFunctions.ts @@ -218,8 +218,9 @@ export const fillForm: PlayFunction = async (context) => { const canvas = within(context.canvasElement); const { - form = (await canvas.queryByRole("form")) || - (await canvas.findByRole("dialog")), // Fixme + form = await canvas + .findByRole("form") + .catch(async () => await canvas.findByRole("dialog")), // FIXME formValues = {}, submitForm = true, } = context.parameters.fillForm as FillFormParameters; @@ -251,6 +252,7 @@ export const fillForm: PlayFunction = async (context) => { await userEvent.click(option, { delay: 100 }); } else { const input = field as HTMLInputElement; + await userEvent.clear(input); await userEvent.type(input, value, { delay: 10, skipClick: false }); } } diff --git a/frontend/src/fixtures/index.ts b/frontend/src/fixtures/index.ts new file mode 100644 index 00000000..6aee30d0 --- /dev/null +++ b/frontend/src/fixtures/index.ts @@ -0,0 +1,17 @@ +export * from "./auditLog"; +export * from "./coReview"; +export * from "./destructionList"; +export * from "./destructionListItem"; +export * from "./factory"; +export * from "./informatieObjectTypeChoices"; +export * from "./paginatedZaken"; +export * from "./response"; +export * from "./resultaatTypeChoices"; +export * from "./review"; +export * from "./reviewItem"; +export * from "./reviewers"; +export * from "./selectieLijstKlasseChoices"; +export * from "./statusTypeChoices"; +export * from "./user"; +export * from "./zaak"; +export * from "./zaaktypeChoices"; diff --git a/frontend/src/fixtures/informatieObjectTypeChoices.ts b/frontend/src/fixtures/informatieObjectTypeChoices.ts new file mode 100644 index 00000000..65c40c7a --- /dev/null +++ b/frontend/src/fixtures/informatieObjectTypeChoices.ts @@ -0,0 +1,64 @@ +import { Option } from "@maykin-ui/admin-ui"; + +import { createArrayFactory, createObjectFactory } from "./factory"; + +export const FIXTURE_INFORMATIE_OBJECTTYPE_CHOICES = [ + { + label: "Informatie object type 1", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/b0b28783-052d-414a-867d-81cf52725506", + }, + { + label: "Informatie object type 2", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/3007e984-c529-4a07-b32e-555b4c882ce5", + }, + { + label: "Informatie object type 3", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/b25201a6-2d1e-42ca-bff6-417ce5b4cb4a", + }, + { + label: "Informatie object type 4", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/4ff5a190-8dc8-4ee7-b018-92ae90f564bf", + }, + { + label: "Informatie object type 5", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/d2dc7b42-a3d6-42b8-90c5-d54342c02357", + }, + { + label: "Informatie object type 6", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/c91c1e80-78e9-417a-b828-4f5dbcfd12a7", + }, + { + label: "Informatie object type 7", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/5cff5507-bf01-4d02-9a60-292b254974f6", + }, + { + label: "Informatie object type 8", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/4616eb79-112f-4575-bd3a-2faa5fef31ab", + }, + { + label: "Informatie object type 9", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/bece20a5-8e01-4bc5-9ba0-7c853cff46a0", + }, + { + label: "Informatie object type 10", + value: + "http://zaken.nl/catalogi/api/v1/informatieobjecttypen/09428c24-12e5-4c3a-a75c-e9e0d448a93b", + }, +]; + +export const informatieObjectTypeChoiceFactory = createObjectFactory< + Option +>(FIXTURE_INFORMATIE_OBJECTTYPE_CHOICES[0]); + +export const informatieObjectTypeChoicesFactory = createArrayFactory< + Option +>(FIXTURE_INFORMATIE_OBJECTTYPE_CHOICES); diff --git a/frontend/src/fixtures/resultaatTypeChoices.ts b/frontend/src/fixtures/resultaatTypeChoices.ts new file mode 100644 index 00000000..0136b069 --- /dev/null +++ b/frontend/src/fixtures/resultaatTypeChoices.ts @@ -0,0 +1,64 @@ +import { Option } from "@maykin-ui/admin-ui"; + +import { createArrayFactory, createObjectFactory } from "./factory"; + +export const FIXTURE_RESULTAATTYPE_CHOICES = [ + { + label: "resultaattype 1", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/73c8a575-c75c-4c97-ba1f-42c3180ced04", + }, + { + label: "resultaattype 2", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/2af00ef7-d865-4166-9efc-19ab95fed618", + }, + { + label: "resultaattype 3", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/6436c0b9-156a-4e71-8aab-0e03cca85cc6", + }, + { + label: "resultaattype 4", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/ecf89355-866d-4d26-983d-48b9d3883441", + }, + { + label: "resultaattype 5", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/95ffea1c-0e11-4484-9352-cc60bf8c0ae1", + }, + { + label: "resultaattype 6", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/ee3f3076-c818-4176-ba5f-8e1a02cd5eaf", + }, + { + label: "resultaattype 7", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/36367e96-bfb0-4765-a4ef-735da326a9fc", + }, + { + label: "resultaattype 8", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/1a810166-a7cd-421d-b3b8-52e59d6b5957", + }, + { + label: "resultaattype 9", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/1ac42262-dbb8-49bd-a059-3e54752bdb74", + }, + { + label: "resultaattype 10", + value: + "http://zaken.nl/catalogi/api/v1/resultaattypen/4d453f16-04e7-4832-9e90-e59fda7e198d", + }, +]; + +export const resultaatTypeChoiceFactory = createObjectFactory< + Option +>(FIXTURE_RESULTAATTYPE_CHOICES[0]); + +export const resultaatTypeChoicesFactory = createArrayFactory< + Option +>(FIXTURE_RESULTAATTYPE_CHOICES); diff --git a/frontend/src/fixtures/statusTypeChoices.ts b/frontend/src/fixtures/statusTypeChoices.ts new file mode 100644 index 00000000..64db54df --- /dev/null +++ b/frontend/src/fixtures/statusTypeChoices.ts @@ -0,0 +1,64 @@ +import { Option } from "@maykin-ui/admin-ui"; + +import { createArrayFactory, createObjectFactory } from "./factory"; + +export const FIXTURE_STATUSTYPE_CHOICES = [ + { + label: "Statustype 1", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/feedf256-ef74-4d5f-8fc9-6891f58a0d1e", + }, + { + label: "Statustype 2", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/0b016f1a-e10a-4dad-9090-c06bac6ef7e7", + }, + { + label: "Statustype 3", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/155d0b58-c97d-4451-ab0c-a1fdbe65317c", + }, + { + label: "Statustype 4", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/2621072e-3d25-49fa-8e4c-e0797b1bebe9", + }, + { + label: "Statustype 5", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/e8f32e98-802b-4370-9f6b-dffbec588bb8", + }, + { + label: "Statustype 6", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/86f5402e-1b5b-4470-9d95-ed2f798deb03", + }, + { + label: "Statustype 7", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/6c875571-6ef1-4307-a1b6-c5a455fe647a", + }, + { + label: "Statustype 8", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/a318ed24-80ad-4da0-b95f-69913aef994f", + }, + { + label: "Statustype 9", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/56df165f-c657-44b1-a498-ea440e749b05", + }, + { + label: "Statustype 10", + value: + "http://zaken.nl/catalogi/api/v1/statustypen/03003779-800e-4951-844d-7478691cfd13", + }, +]; + +export const statusTypeChoiceFactory = createObjectFactory< + Option +>(FIXTURE_STATUSTYPE_CHOICES[0]); + +export const statusTypeChoicesFactory = createArrayFactory< + Option +>(FIXTURE_STATUSTYPE_CHOICES); diff --git a/frontend/src/fixtures/zaaktypeChoices.ts b/frontend/src/fixtures/zaakTypeChoices.ts similarity index 84% rename from frontend/src/fixtures/zaaktypeChoices.ts rename to frontend/src/fixtures/zaakTypeChoices.ts index 2b6d0e59..35f9904f 100644 --- a/frontend/src/fixtures/zaaktypeChoices.ts +++ b/frontend/src/fixtures/zaakTypeChoices.ts @@ -1,5 +1,6 @@ import { Option } from "@maykin-ui/admin-ui"; +import { ZaaktypeChoice } from "../lib/api/private"; import { createArrayFactory } from "./factory"; const FIXTURE_ZAAKTYPE_CHOICE: Option = { @@ -8,36 +9,42 @@ const FIXTURE_ZAAKTYPE_CHOICE: Option = { "http://localhost:8000/catalogi/api/v1/zaaktypen/64c98539-076e-4fbf-8fec-fa86c560fb24", }; -const FIXTURE_ZAAKTYPE_CHOICES: Option[] = [ +const FIXTURE_ZAAKTYPE_CHOICES: ZaaktypeChoice[] = [ { label: "Aangifte behandelen 1", value: "http://localhost:8000/catalogi/api/v1/zaaktypen/64c98539-076e-4fbf-8fec-fa86c560fb24", + extra: "", }, { label: "Aangifte behandelen 2", value: "http://localhost:8000/catalogi/api/v1/zaaktypen/927eb71c-d99b-4c5d-b3e2-94a07ce85923", + extra: "", }, { label: "Aangifte behandelen 3", value: "http://localhost:8000/catalogi/api/v1/zaaktypen/684b9c68-a36f-4c72-b044-fa9cdcb17ec9", + extra: "", }, { label: "Aangifte behandelen 4", value: "http://localhost:8000/catalogi/api/v1/zaaktypen/e4f2a6b0-9377-400a-b0ce-ed66c0a315da", + extra: "", }, { label: "Aangifte behandelen 5", value: "http://localhost:8000/catalogi/api/v1/zaaktypen/3206d651-d0f2-4690-933d-cc690444184f", + extra: "", }, { label: "Aangifte behandelen 6", value: "http://localhost:8000/catalogi/api/v1/zaaktypen/773b6b77-486a-4b6c-be3e-cf13f4387cf3", + extra: "", }, ]; @@ -45,7 +52,7 @@ const zaaktypeChoiceFactory = createArrayFactory