UNPKG

@kadconsulting/dry

Version:
23 lines 1.14 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { render, fireEvent } from '@testing-library/react'; import RadioButtonGroup from './RadioButtonGroup'; describe('RadioButtonGroup', () => { it('renders correctly', () => { const { getByText } = render(_jsx(RadioButtonGroup, { name: 'testGroup', options: [ { id: 'option1', value: 'Option 1', text: 'Option 1' }, { id: 'option2', value: 'Option 2', text: 'Option 2' }, ] })); expect(getByText('Option 1')).toBeInTheDocument(); expect(getByText('Option 2')).toBeInTheDocument(); }); it('handles onChange', () => { const handleChange = jest.fn(); const { getByLabelText } = render(_jsx(RadioButtonGroup, { name: 'testGroup', options: [ { id: 'option1', value: 'Option 1', text: 'Option 1' }, { id: 'option2', value: 'Option 2', text: 'Option 2' }, ], onChange: handleChange })); fireEvent.click(getByLabelText('Option 1')); expect(handleChange).toHaveBeenCalled(); }); }); //# sourceMappingURL=RadioButtonGroup.test.js.map