diff --git a/src/SelectableBox/tests/SelectableBoxSet.test.jsx b/src/SelectableBox/tests/SelectableBoxSet.test.jsx index aa89e08d0f..90e9f6d1fc 100644 --- a/src/SelectableBox/tests/SelectableBoxSet.test.jsx +++ b/src/SelectableBox/tests/SelectableBoxSet.test.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { mount } from 'enzyme'; import renderer from 'react-test-renderer'; +import { render, screen } from '@testing-library/react'; import { Form } from '../..'; import SelectableBox from '..'; @@ -37,8 +38,9 @@ describe('', () => { const tree = renderer.create(()).toJSON(); expect(tree).toMatchSnapshot(); }); - it('renders with props', () => { - // TODO: use react-testing-library to make assertion + it('forwards props', () => { + render(()); + expect(screen.getByTestId('test-radio-set-name')).toBeTruthy(); }); it('correct render when type prop is changed', () => { const setWrapper = mount(); @@ -87,5 +89,21 @@ describe('', () => { const selectableBoxSet = wrapper.find(Form.RadioSet); expect(selectableBoxSet.hasClass(`pgn__selectable_box-set--${columns}`)).toBe(true); }); + it('renders with an aria-label attribute', () => { + render(()); + expect(screen.getByLabelText('test-radio-set-label')).toBeTruthy(); + }); + it('renders with an aria-labelledby attribute', () => { + render(( + <> +

Radio Set Label text

+ + + )); + expect(screen.getByLabelText('Radio Set Label text')).toBeTruthy(); + }); }); });