mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 02:11:07 +05:30
14 lines
543 B
TypeScript
14 lines
543 B
TypeScript
import { describe, it, expect, vi } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
import userEvent from '@testing-library/user-event';
|
|
import { Switch } from '@/components/ui/switch';
|
|
|
|
describe('Switch', () => {
|
|
it('toggles checked state', async () => {
|
|
const onCheckedChange = vi.fn();
|
|
render(<Switch aria-label="airplane" onCheckedChange={onCheckedChange} />);
|
|
await userEvent.click(screen.getByRole('switch', { name: /airplane/i }));
|
|
expect(onCheckedChange).toHaveBeenCalledWith(true);
|
|
});
|
|
});
|