mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
* e2e test for manage user page, and updating styles for ui components * make checkbox more accessible and create e2e test around creating user * add react testing library and use it for radio testing * clean up comments * update docs and clean up
34 lines
850 B
TypeScript
34 lines
850 B
TypeScript
import React from 'react';
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
import Radio from './Radio';
|
|
|
|
describe('Radio - component', () => {
|
|
it('renders the correct selected state', () => {
|
|
render(<Radio
|
|
checked
|
|
label={'Test Radio'}
|
|
value={'Test Radio'}
|
|
id={'test-radio'}
|
|
onChange={() => { return null; }}
|
|
name={'Test Radio'}
|
|
/>);
|
|
|
|
const radio = screen.getByRole('radio', { name: 'Test Radio' });
|
|
expect(radio).toBeChecked();
|
|
});
|
|
|
|
it('renders the correct disabled state', () => {
|
|
render(<Radio
|
|
disabled
|
|
label={'Test Radio'}
|
|
value={'Test Radio'}
|
|
id={'test-radio'}
|
|
onChange={() => { return null; }}
|
|
name={'Test Radio'}
|
|
/>);
|
|
|
|
const radio = screen.getByRole('radio', { name: 'Test Radio' });
|
|
expect(radio).toBeDisabled();
|
|
});
|
|
});
|