Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix-6455]: Refactor RadioGroup counter #3122

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Button, ButtonContent, Content, Wrapper, Border } from './styled'
type Props = {
id: string
title: string
count: number | string
count?: number | string
onToggle?: (open: boolean) => void
children: React.ReactNode
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ const FilterForm = ({
<Accordion
id="feedback"
title="Feedback"
count={state.options.feedback?.length ?? ''}
count={state.options.feedback && '1'}
>
<RadioGroup
defaultValue={state.options.feedback}
Expand Down Expand Up @@ -595,7 +595,7 @@ const FilterForm = ({
<Accordion
id="punctuality"
title="Doorlooptijd"
count={state.options.punctuality?.length ?? ''}
count={state.options.punctuality && '1'}
>
<RadioGroup
defaultValue={state.options.punctuality}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ const withContext = (
)
}

// TODO: these tests broke when updating MSW, should be fixed
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('signals/incident-management/components/FilterForm', () => {
describe('signals/incident-management/components/FilterForm', () => {
beforeEach(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down Expand Up @@ -376,10 +374,20 @@ describe.skip('signals/incident-management/components/FilterForm', () => {

it('should render a list of punctuality options', () => {
const { container } = render(withContext(<FilterForm {...formProps} />))
const node = container.querySelectorAll(
'input[type="radio"][name="punctuality"]'
)

expect(
container.querySelectorAll('input[type="radio"][name="punctuality"]')
).toHaveLength(dataLists.punctuality.length + 1) // by default, a radio button with an empty value is rendered
expect(node).toHaveLength(dataLists.punctuality.length + 1) // by default, a radio button with an empty value is rendered

const test2 = screen.getByLabelText('Binnen de afhandeltermijn')

userEvent.click(test2)

// The radioGroup counter shows (1) when an option is selected
const punctualityCounter = screen.getByText(/(1)/)

expect(punctualityCounter).toBeInTheDocument()
})

it('should render a list of source options', () => {
Expand Down Expand Up @@ -576,7 +584,9 @@ describe.skip('signals/incident-management/components/FilterForm', () => {
})
})

describe('assigned_user_email', () => {
// TODO: these tests broke when updating MSW, should be fixed
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('assigned_user_email', () => {
const label = /toegewezen aan/i
const notAssignedLabel = 'Niet toegewezen'
const submitLabel = 'Filter'
Expand Down
Loading