Skip to content

Commit 13be273

Browse files
♻️ - refactor: refactor detail view to use hook for secondary navigation
1 parent a37da0b commit 13be273

File tree

8 files changed

+542
-506
lines changed

8 files changed

+542
-506
lines changed

frontend/src/lib/zaakSelection/zaakSelection.ts

+17
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ export async function getFilteredZaakSelection<DetailType = unknown>(
115115
return Object.fromEntries(filteredEntries);
116116
}
117117

118+
/**
119+
* Gets the number of selected zaken.
120+
* Note: only the `url` of selected `zaken` are stored.
121+
* Note: This function is async to accommodate possible future refactors.
122+
* @param key A key identifying the selection
123+
* @param exp
124+
* @param selectedOnly
125+
*/
126+
export async function getZaakSelectionSize<DetailType = unknown>(
127+
key: string,
128+
exp?: Partial<DetailType>,
129+
selectedOnly = true,
130+
) {
131+
const selection = await getFilteredZaakSelection(key, exp, selectedOnly);
132+
return Object.keys(selection).length;
133+
}
134+
118135
/**
119136
* Returns a single zaak in the zaak selection.
120137
* @param key A key identifying the selection

frontend/src/pages/destructionlist/detail/DestructionListDetail.stories.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ export const ProcessReview: Story = {
285285
await userEvent.keyboard("{Escape}");
286286

287287
const dialog = await canvas.findByRole("dialog");
288-
const close = await within(dialog).findByRole("button", { name: "Close" });
288+
const close = await within(dialog).findByRole("button", {
289+
name: "Annuleren",
290+
});
289291
await userEvent.click(close, { delay: 300 });
290292

291293
await waitFor(
@@ -471,15 +473,20 @@ export const DeleteDestructionList: Story = {
471473
...context,
472474
parameters: {
473475
...context.parameters,
474-
name: "Vernietigen starten",
476+
name: /Vernietigen/,
477+
exact: false,
475478
},
476479
});
477480
const canvas = within(context.canvasElement);
478481
const submit = await canvas.findByText<HTMLButtonElement>(
479-
"10 zaken vernietigen",
482+
"zaken vernietigen",
483+
{ exact: false },
484+
);
485+
const input = await canvas.getByLabelText(
486+
"Type naam van de lijst ter bevestiging",
480487
);
481488
expect(submit).toBeDisabled();
482-
await userEvent.click(document.activeElement as HTMLInputElement, {
489+
await userEvent.click(input, {
483490
delay: 10,
484491
});
485492
userEvent.type(
@@ -527,6 +534,7 @@ export const DeleteFailedDestructionList: Story = {
527534
},
528535
},
529536
},
537+
play: DeleteDestructionList.play,
530538
};
531539

532540
const FIXTURE_CANCEL_PLANNED_DESTRUCTION: DestructionListDetailContext = {

0 commit comments

Comments
 (0)