Skip to content

Commit

Permalink
comet-ui-toggle-comp # added A11Y test in component
Browse files Browse the repository at this point in the history
  • Loading branch information
kildre committed Jan 31, 2024
1 parent f93fc85 commit c853375
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/comet-extras/src/components/toggle/toggle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React from 'react';
import { render, fireEvent, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { axe } from 'jest-axe';
import { Toggle } from './toggle'; // Assuming the Toggle component is in the same directory

describe('Toggle Component Tests', () => {
test('should render with no accessibility violations', async () => {
const { container } = render(
<Toggle id="test-toggle" label="Test toggle" onChange={jest.fn()} />,
);
expect(await axe(container)).toHaveNoViolations();
});
// Test to check if the Toggle renders correctly
test('renders the Toggle component', () => {
render(<Toggle id="test-toggle" />);
Expand Down

0 comments on commit c853375

Please sign in to comment.