ant-design/tests/shared/accessibilityTest.tsx
叶枫 502dac12aa
docs: format code (#48309)
* docs: fix code

* feat: lint

* feat: prettier

* feat: test

* feat: review

* feat: format html

* feat: format html
2024-04-08 14:04:08 +08:00

16 lines
510 B
TypeScript

import React from 'react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';
// eslint-disable-next-line jest/no-export
export default function accessibilityTest(Component: React.ComponentType) {
describe(`accessibility`, () => {
it(`component does not have any violations`, async () => {
jest.useRealTimers();
const { container } = render(<Component />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
}