nexxtway/react-rainbow

View on GitHub
src/components/CheckboxGroup/__test__/checkboxGroup.a11y.spec.js

Summary

Maintainability
A
3 hrs
Test Coverage
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import axe from '../../../../axe';
import CheckboxGroup from '..';

const options = [
    { value: 'checkboxOne', label: 'Checkbox One' },
    { value: 'checkboxTwo', label: 'Checkbox Two' },
    { value: 'checkboxThree', label: 'Checkbox Three' },
];

describe('<CheckboxGroup/>', () => {
    it('should be accessible when all options have a label passed', async () => {
        expect.assertions(1);
        const html = ReactDOMServer.renderToString(
            <CheckboxGroup label="Checkbox Group Label" options={options} />,
        );
        const results = await axe(html);
        expect(results).toHaveNoViolations();
    });
});